<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[DFIR Dudes - Medium]]></title>
        <description><![CDATA[Yet another DFIR blog, authored by Martin Korman &amp; Hadar Yudovich - Medium]]></description>
        <link>https://medium.com/dfir-dudes?source=rss----52c0e984ec3---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>DFIR Dudes - Medium</title>
            <link>https://medium.com/dfir-dudes?source=rss----52c0e984ec3---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 11:14:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/dfir-dudes" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[regipy-rs: Parsing a SOFTWARE Hive in 0.3 Seconds Instead of 12 Minutes]]></title>
            <link>https://medium.com/dfir-dudes/regipy-rs-parsing-a-software-hive-in-0-3-seconds-instead-of-12-minutes-13e8453fa10b?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/13e8453fa10b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[windows-forensics]]></category>
            <category><![CDATA[computer-forensics]]></category>
            <dc:creator><![CDATA[martin korman]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 14:44:48 GMT</pubDate>
            <atom:updated>2026-07-18T14:52:13.885Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Porting regipy’s core to Rust and proving, byte for byte, that nothing else changed.</em></strong></p><p><a href="https://medium.com/dfir-dudes/regipy-automating-registry-forensics-with-python-b170a1e2b474">Seven</a> years ago I started writing Regipy because I wanted a registry parser that worked the way investigators work. Somewhere along the road, one item settled onto the wishlist and refused to leave: port the core parser to Rust. Every time a SOFTWARE hive took lots of time to dump, I thought about it. Last week I finally did it.</p><p>The headline number first. A full traversal of a real-world SOFTWARE hive: 117,488 keys, every value decoded went from 12 minutes and 25 seconds to 0.29 seconds. That’s the exact workload `regipy-dump` and every triage pipeline built on regipy runs all day.</p><p>But speed was never the hard part of this project. If you work in DFIR, you already know the question that matters more: is the fast parser still telling me the truth? A registry parser that’s a thousand times faster but occasionally decodes a value differently isn’t an upgrade. So most of the work and most of this post is about proving that the output didn’t change. Not promising. Proving.</p><p>`regipy-rs` is an opt-in backend, published as a separate alpha package. The pure-Python parser remains the default, untouched:</p><pre>pip install regipy[rust]</pre><pre>from regipy.registry_rs import RegistryHive # instead of regipy.registry<br>reg = RegistryHive(&#39;/evidence/SOFTWARE&#39;)<br>key = reg.get_key(r&#39;\Microsoft\Windows\CurrentVersion\Run&#39;)<br>for value in key.iter_values(as_json=True):<br>print(value.name, value.value)</pre><p>Same API, same `Value` and `Subkey` dataclasses, same exceptions. Every regipy plugin: all 75+ of them , runs unchanged on either backend. If you’ve built tooling on regipy, adopting this is a one-line import change.</p><p>The numbers, from the benchmark report committed to the repo (full traversal with values, best of 3):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*ryHGdEQ8pd8cgUCKwZIG0g.png" /></figure><p>Why so dramatic? `cProfile` tells the story in two lines. Traversing a UsrClass.dat hive costs the Python backend 2.54 million function calls: struct parsing, stream reads, per-value decoding. The Rust backend does the same traversal in about 25 thousand calls, and the profile shows the parser has simply vanished. What’s left is the cost of handing you the results.</p><pre># Python backend cProfile:<br>         2540885 function calls (2450810 primitive calls) in 1.623 seconds<br>   Ordered by: cumulative time<br>   List reduced from 121 to 10 due to restriction &lt;10&gt;<br>   ncalls  tottime  percall  cumtime  percall filename:lineno(function)<br>        2    0.001    0.001    1.643    0.822 {built-in method builtins.sum}<br>     6206    0.004    0.000    1.642    0.000 benchmark.py:51(&lt;genexpr&gt;)<br>45543/6206    0.042    0.000    1.638    0.000 registry.py:164(recurse_subkeys)<br>     4396    0.011    0.000    1.274    0.000 registry.py:210(&lt;listcomp&gt;)<br>    16765    0.123    0.000    0.999    0.000 registry.py:481(iter_values)<br>    12369    0.046    0.000    0.531    0.000 registry.py:441(read_value)<br>   284770    0.490    0.000    0.490    0.000 {method &#39;read&#39; of &#39;_io.BytesIO&#39; objects}<br>    43635    0.049    0.000    0.443    0.000 core.py:290(parse_stream)<br>44555/43635    0.019    0.000    0.364    0.000 core.py:311(_parsereport)<br>    21625    0.009    0.000    0.300    0.000 core.py:786(_parse)</pre><pre># Rust backend cProfile:<br>         24835 function calls in 0.024 seconds<br>   Ordered by: cumulative time<br>   List reduced from 14 to 10 due to restriction &lt;10&gt;<br>   ncalls  tottime  percall  cumtime  percall filename:lineno(function)<br>        1    0.001    0.001    0.023    0.023 {built-in method builtins.sum}<br>     6206    0.002    0.000    0.023    0.000 benchmark.py:51(&lt;genexpr&gt;)<br>     6206    0.017    0.000    0.021    0.000 registry_rs.py:202(recurse_subkeys)<br>     6205    0.003    0.000    0.003    0.000 registry_rs.py:234(&lt;listcomp&gt;)<br>     6205    0.001    0.000    0.001    0.000 &lt;string&gt;:2(__init__)<br>        1    0.000    0.000    0.000    0.000 registry_rs.py:166(__init__)<br>        1    0.000    0.000    0.000    0.000 {method &#39;recurse&#39; of &#39;regipy_rs.RegistryHive&#39; objects}<br>        1    0.000    0.000    0.000    0.000 utils.py:156(identify_hive_type)<br>        1    0.000    0.000    0.000    0.000 {method &#39;root&#39; of &#39;regipy_rs.RegistryHive&#39; objects}<br>        4    0.000    0.000    0.000    0.000 {method &#39;endswith&#39; of &#39;str&#39; objects}</pre><p>I didn’t want parity to be a sentence in the PR. I wanted it to be a test suite that would alert me loudly if I got anything wrong. It ended up with four layers.</p><p><strong>Full traversal comparison:</strong> Both backends walk every test hive in regipy’s corpus, and every key path, timestamp, value name, value type and value content must match, including iteration order. Corrupted hives too: both backends must yield the same partial output before failing the same way.</p><p><strong>Plugin-level parity:</strong> Every validated plugin runs end-to-end on both backends and must produce identical results. This is the layer your casework actually consumes, so it gets tested directly.</p><p><strong>A 60,000-sample timestamp fuzz:</strong> Windows FILETIME conversion involves a float division and Python’s round-half-even microsecond rounding, and the Rust port replicates that arithmetic bit for bit. The fuzz test earned its keep on day one: it caught a double-rounding bug in my first implementation that was off by a single microsecond on certain timestamps. I noticed it only because the test existed. That’s the point of the test.</p><p><strong>“Notarized” digests:</strong> The benchmark computes a SHA-256 over the canonicalized traversal output of each hive, roughly 201,000 keys and 392,000 values from each backend, and publishes the digests side by side. Anyone can recompute them with one command. If a single byte diverged, the hashes would say so.</p><p>There are a few intentional divergences: exception types on some corrupted-hive paths, and a cycle guard where Python would hit its recursion limit. They’re documented in the report, and none of them affect parsed output. I’d rather list them myself than have you find them.</p><p><strong>The part I didn’t expect: the old parser was wrong (a little)</strong></p><p>Here’s my favorite finding of the whole project. When you build a byte-exact comparison between two parsers, every historical quirk becomes a loud test failure. Those failures turned out to be bugs in the Python parser that had been shipping for years:</p><p><strong>The `NUMBER_OF_PROCESSORS: 49` bug:</strong> Small registry values, four bytes or less are stored inline, inside the VK record’s offset field. regipy returned that field as a raw integer instead of decoding it. So `NUMBER_OF_PROCESSORS` on a SYSTEM hive came back as `49`.</p><p>Why 49? Because the real value is the string `”1&quot;`, and 49 is the ASCII code for `’1&#39;`. Every inline `REG_SZ` in every hive regipy ever parsed had this problem. One plugin had even quietly grown an `isinstance(value, int)` workaround around it, which should have told me something sooner.</p><p><strong>Garbage multi-strings:</strong> `REG_MULTI_SZ` values larger than 16 KB are stored in “big data” segments. regipy never reassembled them, it decoded the raw segment-pointer record as UTF-16 and returned noise. The WBEM `Autorecover MOFs` value on a SOFTWARE hive now correctly returns its 277 MOF paths.</p><p>All were fixed in the Python parser as well, which meant also fixing regipy’s own test expectations, some of which had the buggy values baked in as “expected.”</p><p><strong>Try it!</strong></p><p>regipy-rs is alpha. The parity evidence is strong, but it’s new code, and hives from the wild have infinite edge cases. The pure-Python parser stays the default until the Rust backend has real mileage on it.</p><pre>pip install regipy[rust]<br><br># Confirm installation:<br>python -c &quot;import regipy_rs; print(regipy_rs.__version__, regipy_rs.__file__)&quot;<br><br># Excpect: 0.1.0a1 <br><br># Copy the SOFTWARE hive from tests:<br>cp regipy_tests/data/SOFTWARE.xz /tmp/<br>unxz /tmp/SOFTWARE.xz<br><br># Iterate over the hive with the new library:<br>time python - &lt;&lt;&#39;EOF&#39;<br>from regipy.registry_rs import RegistryHive<br>reg = RegistryHive(&quot;/tmp/SOFTWARE&quot;)<br>print(reg.hive_type, [x for x in reg.recurse_subkeys(fetch_values=True)], &quot;keys&quot;)<br>EOF</pre><p>Example time output on my laptop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*Y6EFeHUaWubzNoCN416NYg.png" /></figure><p>Everything in this post is reproducible from the repo: the benchmark report, the profiles, and the parity digests regenerate with a single command (`python regipy-rs/benchmark.py`). Run it on your own evidence sets.</p><p><a href="https://pypi.org/project/regipy-rs/">https://pypi.org/project/regipy-rs/</a></p><p><a href="https://github.com/mkorman90/regipy">GitHub - mkorman90/regipy: Regipy is an os independent python library for parsing offline registry hives</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13e8453fa10b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/regipy-rs-parsing-a-software-hive-in-0-3-seconds-instead-of-12-minutes-13e8453fa10b">regipy-rs: Parsing a SOFTWARE Hive in 0.3 Seconds Instead of 12 Minutes</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Regipy MCP: Natural Language Registry Forensics with Claude]]></title>
            <link>https://medium.com/dfir-dudes/regipy-mcp-natural-language-registry-forensics-with-claude-984d378784d6?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/984d378784d6</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[windows-registry]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[martin korman]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 19:58:08 GMT</pubDate>
            <atom:updated>2026-01-04T19:58:08.732Z</atom:updated>
            <content:encoded><![CDATA[<p>Six years ago, I wrote a <a href="https://medium.com/dfir-dudes/regipy-automating-registry-forensics-with-python-b170a1e2b474">blog post</a> introducing <a href="https://github.com/mkorman90/regipy">regipy</a>, a Python library I built because I was frustrated with existing registry forensic tools. I needed a tool that could parse registry hives at scale, apply transaction logs automatically, and had an intuitive plugin system that would encourage contribution. The DFIR community adopted it, contributors added plugins, and regipy grew to support 75+ forensic artifacts across all major Windows registry hives.</p><p>But reflecting on my years of incident response work, I noticed a recurring friction point. Even with all those plugins available, investigators (including myself) still need to:</p><ul><li>Remember which plugin extracts which artifact, and this might vary between operation system versions</li><li>Know the exact command-line syntax for the tool</li><li>Mentally map forensic questions to technical tool invocations</li><li>Run multiple plugins and correlate the results manually or in some analytics tool like Pandas or Google sheets</li></ul><p>I found myself thinking: I just want to ask<em> “What persistence mechanisms exist on this machine?” </em>and get an answer.</p><p>With LLMs becoming capable enough to reason about forensic workflows, I decided to build exactly that.</p><p><strong>Leveraging Model Context Protocol</strong></p><p>Anthropic released the <a href="https://modelcontextprotocol.io/">Model Context Protocol</a> (MCP), a standard for connecting AI assistants like Claude to external tools and data sources. It clicked immediately: I could expose regipy’s entire plugin ecosystem to Claude and let it figure out which plugins to run based on natural language questions.</p><p><strong>Regipy MCP server</strong> bridges between Claude Desktop and regipy enabling conversational forensic analysis of Windows registry hives.</p><p><strong>What I Wanted</strong></p><p>Before building this, I outlined my requirements (just like I did six years ago):</p><ul><li><strong>Ask forensic questions in plain English: </strong>“What’s the hostname?”, not `registry-run-plugins -plugins computer_name`</li><li><strong>Automatic hive detection:</strong> Point at a directory of collected registry files and have it figure out which is SYSTEM, which is SOFTWARE, etc</li><li><strong>Leverage existing plugins: </strong>All 75+ regipy plugins should just work, no rewrites and no need to update the prompt when introducing new plugins</li><li><strong>Smart plugin selection:</strong> Ask about persistence, and it should know to run both `software_plugin` and `ntuser_persistence`</li><li><strong>Easy setup:</strong> Configure Claude Desktop → point at evidence → start investigating</li></ul><p><strong>Introducing </strong><a href="https://github.com/mkorman90/regipy/tree/master/regipy_mcp_server"><strong>regipy-mcp</strong></a><strong>:</strong></p><p>The MCP server exposes seven tools that Claude can use during a conversation:</p><ul><li><strong>list_available_hives</strong> — Show all detected registry hives by type</li><li><strong>list_available_plugins</strong> — Display all plugins with hive compatibility</li><li><strong>run_plugin</strong> — Execute a specific plugin by name</li><li><strong>run_all_plugins_for_hive</strong> — Run every compatible plugin for a hive type</li><li><strong>answer_forensic_question</strong> — Natural language → plugin mapping</li><li><strong>get_registry_key</strong> — Direct access to any registry key path</li><li><strong>set_hive_directory</strong> — Load hives from a new directory at runtime, this is in order to work in subdirectories grouping artifacts per machine.</li></ul><p>The magic is in answer_forensic_question. It maps common forensic queries to the right combination of plugins. For example:</p><ul><li>“What is the hostname?” → runs <a href="https://github.com/mkorman90/regipy/blob/master/regipy/plugins/system/computer_name.py">computer_name</a></li><li>“What is the time zone?” → runs <a href="https://github.com/mkorman90/regipy/blob/master/regipy/plugins/system/timezone_data.py">timezone_data</a></li><li>“What are the persistence mechanisms?” → runs <a href="https://github.com/mkorman90/regipy/blob/master/regipy/plugins/software/persistence.py">software_persistence</a>, <a href="https://github.com/mkorman90/regipy/blob/master/regipy/plugins/ntuser/persistence.py">ntuser_persistence</a></li><li>“What USB devices were connected?” → runs <a href="https://github.com/mkorman90/regipy/blob/d50d636832ab82fc6aae815e1d0f76ec15fe025f/regipy/plugins/system/usbstor.py#L21">usbstor_plugin</a>, <a href="https://github.com/mkorman90/regipy/blob/d50d636832ab82fc6aae815e1d0f76ec15fe025f/regipy/plugins/system/usb_devices.py#L26">usb_devices</a></li><li>“What programs are installed?” → runs installed_programs_software, installed_programs_ntuser</li><li>“Show me user activity” → runs typed_urls, recent_docs, user_assist</li><li>“What services are configured?” → runs services</li><li>“Show me program execution evidence” → runs shimcache, amcache, bam</li></ul><h4><em>Plugin Coverage</em></h4><p>The 75 plugins span eight hive types (<a href="https://github.com/mkorman90/regipy/pull/310">New plugins</a> were recently added leveraging Claude code!):</p><ul><li><strong>SYSTEM (28 plugins)</strong>: Computer name, timezone, services, USB storage, network interfaces, shimcache, BAM/DAM, control sets, and more</li><li><strong>SOFTWARE (21 plugins)</strong>: Windows version, persistence mechanisms, UAC settings, Windows Defender config, PowerShell logging, installed programs</li><li><strong>NTUSER.DAT (21 plugins)</strong>: User persistence (Run keys), typed URLs, recent documents, UserAssist, run MRU, word wheel query</li><li><strong>SAM (2 plugins)</strong>: Local user accounts</li><li><strong>SECURITY (1 plugin)</strong>: Domain cached credentials info</li><li><strong>AMCACHE (1 plugin)</strong>: Application execution history</li><li><strong>UsrClass.dat (1 plugin)</strong>: Shell bags (folder access history)</li><li><strong>BCD (1 plugin)</strong>: Boot configuration</li></ul><h4>Demo</h4><p>Here’s what a typical session looks like. I’ve collected registry hives from a potentially compromised Windows machine and wanted to understand what happened.</p><p><em>“What registry hives are currently available in the system?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*q5bUhQVsnxUIWMUd.png" /></figure><p>Claude (using regipy) quickly provided me an overview of the collection of registry hives available for investigation. Claude automatically:</p><ul><li>Called the list_available_hives MCP tool</li><li>Categorized 8 hives by type (SYSTEM, SOFTWARE, NTUSER, SAM, etc.)</li><li>Explained what each hive contains</li></ul><p><em>“What are the persistence mechanisms?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*NFmj2k_GDwAvgy9Z.png" /></figure><p>Claude called the answer_forensic_question tool, ran both SOFTWARE and NTUSER persistence plugins, found VMware Tools, Adobe ARM, McAfee components and even flagged an interestingly suspicious entry: svchost in an unusual location.</p><p><em>“What is the most recent software installed on the machine and when was it last booted?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/0*yZO-gWZXSv0PIx4m.png" /></figure><p>Claude automatically ran the installed_programs_software plugin and the shutdown plugin. It found Adobe Reader X (10.1.0) was most recently installed (Aug 28, 2011), gave a full software installation timeline, and reported on the last shutdown.</p><p>What would have taken 15–20 minutes of running individual plugins and correlating output, took about two minutes of conversation. More importantly, I could follow my investigative instincts, asking follow-up questions as findings emerged rather than context-switching between command-line invocations.</p><h4><strong>What I Learned</strong></h4><p>Six years ago, I wrote that working on regipy taught me a lot about registry structure, the complexity of the binary format, resident vs. non-resident data and the importance of transaction logs.</p><p>Building the MCP server taught me something different: <strong>the value of meeting investigators where they think, not where the tools are.</strong></p><p>Every forensic tool has a learning curve. Command-line syntax, output formats, knowing which tool extracts which artifact… It’s all unnecessary friction that slows down investigations. The registry hasn’t gotten any simpler, but the barrier to extracting forensic value from it just got a lot lower.</p><p>The MCP server is available now in regipy. See setup instructions <a href="https://github.com/mkorman90/regipy/tree/master/regipy_mcp_server">here</a>.</p><p><strong>Links:</strong></p><p>- Original regipy <a href="https://medium.com/dfir-dudes/regipy-automating-registry-forensics-with-python-b170a1e2b474">introduction </a>(2019)</p><p>- Regipy on <a href="https://github.com/mkorman90/regipy">GitHub</a></p><p>- MCP Server <a href="https://github.com/mkorman90/regipy/pull/314">Pull Request</a></p><p>- <a href="https://modelcontextprotocol.io/">About</a> Model Context Protocol</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=984d378784d6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/regipy-mcp-natural-language-registry-forensics-with-claude-984d378784d6">Regipy MCP: Natural Language Registry Forensics with Claude</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AmCache is not alone; Using .WER files to hunt evil]]></title>
            <link>https://medium.com/dfir-dudes/amcache-is-not-alone-using-wer-files-to-hunt-evil-86bdfdb216d7?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/86bdfdb216d7</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[martin korman]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 09:12:28 GMT</pubDate>
            <atom:updated>2019-06-26T09:12:27.895Z</atom:updated>
            <content:encoded><![CDATA[<h3>AmCache is not alone; Using .WER files to hunt evil</h3><p>TL;DR — Starting Windows 10, most of *.WER files include the process’ hash, which can be used for hunting in the same way that AmCache is being used.</p><h4>How it all started</h4><p>Lately, I have been poking around with the concept of dump files. I was trying to see if we can find dumped process files which were left on disk and then leverage them in order to hunt for suspicious activity. This is not something new, and people have discussed it in the past. For example:</p><p><a href="https://twitter.com/Lee_Holmes">@Lee Holmes</a> wrote on his blog about how one can extract activity history from PowerShell process dumps (<a href="https://www.leeholmes.com/blog/2019/01/04/extracting-activity-history-from-powershell-process-dumps/">here</a>).</p><p><a href="https://twitter.com/JamesHabben">@James Habben</a> also wrote about a case he had that involved a dump file. In that case he found a crash dump that lead him to the initial infection vector, which was a flash exploit.</p><h4>WER &amp; DFIR</h4><p>While I was going through dump files and trying to research further, I recalled that in some cases, when a program crashes on Windows, an error report file is being generated. That report file is part of the <strong>Windows Error Reporting</strong> feature which automatically submits user-mode process crashes to Microsoft.</p><p>The use of WER files for DFIR purposes is not new either. Kim Jinkook (<a href="https://twitter.com/pr0neer">@pr0neer</a>) <a href="http://forensic-proof.com/archives/4358?ckattempt=1">wrote about it</a> back in 2012, and so did <a href="https://twitter.com/corey_harrell">@Corey Harrell</a> back in 2014, in his great blog — Journey Into Incident Response (<a href="http://journeyintoir.blogspot.com/2014/02/exploring-windows-error-reporting.html">here</a>).</p><p>The blog posts are great and they detail how the evidence is being created, what is included in the evidence and how it can be used during investigations. Additionally, both of them mention that this evidence can be used as a <strong>process execution evidence</strong> and as part of a <strong>forensics timeline</strong>.</p><h4>So, what’s new?</h4><p>Well, from the tests we did, it turns out that starting<strong><em> </em></strong>Windows 10 — some report files now include the actual hash (SHA1) of the executed process. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KU8vpcsfCLCjQvH03Z4TTQ.png" /><figcaption>chrome.exe SHA1 hash, found in a crash report</figcaption></figure><p>As you can see in the image, the hash resides in the value of the “TargetAppId” field, with 4 zeros preceding (exactly like how SHA1 is stored in AmCache).</p><p>Unfortunately, not all reports contain the SHA1 of the file, and we haven’t found (yet) what will determine if the report will includes the hash or not. From our small testing environment, it seems like the reports that do not contain the hash are Microsoft Store applications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*TMV_mCLh-9FRpO_IBC4Vcw.png" /><figcaption>Example entries in which the “TargetAppId” field does not contain the hash</figcaption></figure><p>We did not find anything else besides this valuable piece of information, but our dataset is quite small, so there might be some other useful things!</p><h4>How can we use it?</h4><p>Now that the evidence also include a hash of the executed process, we can extend the ways its being used in DFIR. <br><a href="https://medium.com/u/d6c2728ecb8b">Hadar Yudovich</a> and I once heard<strong><em> </em></strong>Matias Bevilacqua<strong><em> </em></strong>from Mandiant, talking about how they use AmCache and ShimCache on a large scale in order to find suspicious executables. He also wrote about it <a href="https://www.fireeye.com/blog/threat-research/2017/04/appcompatprocessor.html">here</a>. We believe you can add this evidence to the stack and search for suspicious crashes in the same manner that is described in the blog (based on prevalent, for example).</p><h4>Final Words</h4><p>While doing this small research and talking about it with Hadar, we had some interesting thoughts:</p><ol><li>The DFIR community is insane, and the amount of shared knowledge is huge. If you know where and how to search what you look for, someone probably wrote something about it in the past. There’s no need to reinvent the wheel every single time.</li><li>Revisiting existing evidence which were already discussed and analyzed is super important, especially today when Microsoft changes things in their operating systems pretty often.</li><li>We, as a community, must have a dataset of forensic evidence and automated tests that will automatically discover broken evidence and assist in finding their replacement / alternatives.</li></ol><p>Would love to hear any feedback, and thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86bdfdb216d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/amcache-is-not-alone-using-wer-files-to-hunt-evil-86bdfdb216d7">AmCache is not alone; Using .WER files to hunt evil</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KAPEing for fun and profit]]></title>
            <link>https://medium.com/dfir-dudes/kapeing-for-fun-and-profit-85e1f7ee3152?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/85e1f7ee3152</guid>
            <dc:creator><![CDATA[Hadar Yudovich]]></dc:creator>
            <pubDate>Sun, 07 Apr 2019 18:25:34 GMT</pubDate>
            <atom:updated>2019-04-05T23:09:12.184Z</atom:updated>
            <content:encoded><![CDATA[<p>Since everyone in the DFIR is talking about <a href="https://twitter.com/EricRZimmerman">Eric Zimmerman’s</a> KAPE, I wanted to have a look at it too.</p><p>I did have a quick look when it first came out, but I only went over the list of Modules &amp; Targets and thought there is not a lot I can add (after all, it was created by Eric 😆). I created a small pull request to add a <strong><em>Target </em></strong>which will collect the <a href="https://medium.com/dfir-dudes/startupinfo-autoruns-served-up-on-a-plate-ba2da0c753c5?source=friends_link&amp;sk=12b147b638fae92379528444d504023f">StartupInfo</a> files.</p><p>Lately I had more time, and I tried to think of additional targets / modules. I stared at my screen for a while, and then it hit. I need to do something practical. Since I don’t do DFIR for living at the moment, I don’t have any real cases / images. So I used last year’s Unofficial Defcon DFIR CTF, which was created by the amazing Dave Cowen &amp; Matthew Seyer. I challenged myself to solve the entire thing, using only KAPE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*f1zmxEdxjE0eKEfeo5sPbg.png" /></figure><p>Since KAPE is not perfect (yet), there were several questions I could not answer with the existing list of KAPE modules. So I tried to create more targets and modules. Spoiler alert; some things can’t be automated (and even if they can,<strong> you need to understand and know what you are looking for</strong>).</p><p>When I just started, I thought I would describe how I answered each question and which module I used to solve it… but since there are already a lot of walkthroughs and write ups, I decided to only list the new KAPE targets &amp; modules I created.</p><h4>Disclaimer</h4><p>Unfortunately, I didn’t solve the entire CTF using KAPE. For many reasons (trivial questions, image files questions, malware analysis questions, etc.)</p><h4>New KAPE Targets</h4><p>Adding a new target is so easy! Since it allows us to use wildcards and to lookup files recursively, we can collect new evidence easily.</p><p>Since it’s so easy, it makes you want to add a target for every file out there, but that doesn’t make any sense. Targets I did add were related to evidence I thought might be useful in the future too. For example:</p><ol><li><strong>ApacheAccessLog.tkape — </strong>Recursively search for Apache’s access log file.</li><li><strong>TeamViewerLogs.tkape</strong> — Connection related log files of Team Viewer.</li><li><strong>RDPCache.tkape</strong> — Collect the RDP Bitmap Cache files. I also ported the old and classic BMC Viewer to work with a newer version of .NET and changed it to be a command line tool — <a href="https://github.com/hadar0x/RDPBitmapCacheParser/blob/master/RDPBitmapCacheParser.exe">RDPBitmapCacheParser</a>.</li></ol><h4>New KAPE Modules</h4><p>Modules are a bit more complicated, depending on the binary you use to parse the evidence. It was also fun to add new modules, for different reasons.</p><p>Firstly, I learned about new tools — their existence, and how to use them better. Additionally, I was able to point my finger at what I think are the mostly required tools nowadays (commercial tools, closed source tools and evidence with no tools at all). These are the modules I added:</p><ol><li><strong>SMB-Server-Anonymous-Logon.mkape</strong> — Simple module that use LogParser to extract information from the SMB Server event log file.</li><li><strong>ApacheAccessLog.mkape</strong> — At first, I created this one to answer a specific question, but it came quite handy later on in the challenge. This module also uses LogParser to convert the file into a csv file.</li><li><strong>ScheduledTasksFullEventLogView.mkape</strong> — This one uses NirSoft’s FullEventLogView.exe to parse the TaskScheduler event log file.</li></ol><h4>RECmd</h4><p>Like I said, using KAPE made me better understand how other tools work, and improved the way I used them. A small example is RECmd’s ability to read a setting file, and act upon that file. I heavily used a RECmd batch file that was created by Mike Cary, called <em>RECmd_Batch_MC.reb</em>. I did find some things that can be improved an I opened a <a href="https://github.com/EricZimmerman/RECmd/pull/1">pull request</a> to add / fix the following:</p><ol><li>Added shutdown time key.</li><li>Fixed an issue with exporting Network Interfaces.</li></ol><h4>Final Notes</h4><p>While I was doing the challenge, I wrote down some notes that popped into my head. Not facts, just thoughts :)</p><ol><li>“Real Life” challenges are such a great resource. We should have more of these out there — if anyone is willing to share a scenario, I can try building a lab that will imitate that scenario, with no sensitive information.</li><li><strong>KAPE is awesome</strong>. It saves a lot of time for both collection and parsing of valuable forensic evidence. Still, you must know what to look for.</li><li>The most “painful” things that are still not easy to handle with existing tools are related to Windows Event Logs and the $LogFile file. No worries though, Eric told me he’s working on tools for both!</li><li>There is no command line tool to parse Windows Tasks. I might give it a shoot and do something like WTCmd :)</li><li>LogParser.exe is really awesome. I didn’t use it enough in the past and it can be super useful to parse generic log files.</li><li>Maybe there should be a KAPE module for image files information? something that would use tools like fsstat.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85e1f7ee3152" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/kapeing-for-fun-and-profit-85e1f7ee3152">KAPEing for fun and profit</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mac Forensics — No One Said It Would Be Easy]]></title>
            <link>https://medium.com/dfir-dudes/mac-forensics-no-one-said-it-would-be-easy-8bf2f5e4956c?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/8bf2f5e4956c</guid>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[mac-os-x]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[dfir]]></category>
            <dc:creator><![CDATA[Hadar Yudovich]]></dc:creator>
            <pubDate>Tue, 19 Mar 2019 22:03:49 GMT</pubDate>
            <atom:updated>2019-03-20T10:31:42.273Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mac Forensics — No One Said It Would Be Easy</h3><p>TL;DR — Found out that a python based library to parse plist files was marking files as invalid while mac OS treated them as valid files.</p><p>It all started when I wanted to learn something new. I was looking for something to read and do, and then I stumbled upon David Cowen’s Sunday Funday. Although I’ve previously submitted an answer only once, I always scroll through the questions and try to find an answer. This time, the question was related to Mac OS 4n6 😲</p><p>“<em>On OSX Mojave, what information can you determine from the KnowledgeC database?”</em></p><p>Though for years I have been following some great #DFIR people that focus on MacOS Forensics, like Sarah Edwards (<a href="https://twitter.com/iamevltwin">@iamevltwin</a>) and others, I’m a bit ashamed to admit that I haven’t had the chance to do anything practical. I have never owned a Mac, nor have I worked for an organizations that uses them, so I’ve always had a reason for not doing Mac DFIR. Since I was looking to utilize my free time learning something, this was a great opportunity.</p><p>It took me some time to set everything up, and unfortunately, I didn’t get to do the Sunday Funday challenge. Luckily, someone else (<a href="https://twitter.com/tunnaunglin">@tunnaunglin</a>) did. Dave tweeted his winning answer, and Yogesh Khatri (<a href="https://twitter.com/SwiftForensics">@SwiftForensics</a>) suggested that he would integrate his findings into his tool — mac_apt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Oc26QLwB-aTYbbOApPt4Gw.png" /></figure><h4>mac_apt</h4><p>I recalled that I had read about <a href="https://github.com/ydkhatri/mac_apt">mac_apt</a> when it was first published, and was enthused by the project. Being that it is also python based, I decided to try and contribute to the project by adding a plugin or two.</p><p>For those of you who are not familiar with mac_apt, you can watch the SANS talk to better understand how it works; the project’s description on GitHub simplifies it: <em>“mac_apt is a DFIR tool to process Mac computer full disk images (or live machines) and extract data/metadata useful for forensic investigation. It is a python based framework, which has plugins to process individual artifacts…”</em></p><p>Generally, when I research DFIR stuff, I have this kind of process in my head:</p><ol><li>Find existing information — blogs, books, anything.</li><li>Read what attackers / red teams do in the real world.</li><li>Simulate malicious activity in lab if possible.</li><li>Try to detect the malicious activity and left evidence using both live response tools and post-mortem tools to get some ideas.</li></ol><p>So, I found <a href="https://posts.specterops.io/hunting-for-bad-apples-part-1-22ef2b44c0aa">this great post</a> by <a href="https://medium.com/u/71641bec6012">Richie Cyrus</a> who explained how he hunts malicious activity on Macs. His first example was detecting suspicious launch daemons (a common persistence technique used by attackers in the Mac OS world). In his post, Richie used <strong><em>osquery</em></strong>, which is a great <strong>live response</strong> tool.</p><p>When I went over the plugins list in mac_apt, I realized there is no plugin for persistence locations like LaunchDaemons, LaunchAgents, cron jobs, etc. So I decided to write a plugin of my own. I did exactly what Richie did, and installed a malicious backdoor on my Mac, and then I added a malicious LaunchDaemon and everything worked great, on the offensive side.</p><h4>No Pain — No Gain</h4><p>Of course, as with anything learnt for the first time, not everything works smoothly… I created an image of my <em>OSX Mojave </em>machine and ran my new mac_apt plugin against it. Unfortunately, I didn’t get any results. Classic. 😢</p><p>I investigated further and it turned out that the plist file I created with Empire was “invalid”. I got the following error: <em>biplist.InvalidPlistException: XML or text declaration not at start of entity: line 2, column 0</em></p><p>I opened the file manually, and indeed there was an empty line in the beginning of the file, causing the library to determine it’s an invalid file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KmHp2IGDUyGNSmuISFIsQ.png" /><figcaption>the “invalid” plist file with an empty first line</figcaption></figure><p>That’s odd. I checked the LaunchDaemon technique I used and it worked… I even checked the <a href="https://github.com/EmpireProject/Empire/blob/master/lib/modules/python/persistence/osx/launchdaemonexecutable.py#L104">source code of Empire</a>. Although there is indeed an empty line at the beginning of the file, it works. I get a callback from the backdoor.</p><p>I Googled some information and found out a built-in MacOS utility named <strong><em>plutil</em></strong><em>. </em>According to<em> </em>its manual page; “<em>plutil can be used to check the syntax of property list files, or convert a plist file from one format to another”)</em>. Perfect.<br>Ran it against the persistence plist file and got a response that the file is OK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*0dkEvj-arrU2c-xcs2xttQ.png" /></figure><p>So if the operating system says it’s OK, what is wrong with mac_apt?</p><h4>biplist</h4><p>I started debugging the error, and found out that <em>mac_apt</em> uses a library called <a href="https://github.com/wooster/biplist">biplist</a>. It is a great library that wraps another library called <em>plistlib, offering </em>different methods to parse plist files; you can provide it a path or a file object and it will parse it for you. Alternatively, you can provide a string instead.</p><p>I loaded the file, stripped off the first empty line, into a string; and when I passed the string into biplist.readPlistFromString() it parsed it correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*q50K1G4chKW-POP7Xv-LRA.png" /><figcaption>Successful parsing of the “invalid” plist file</figcaption></figure><p>Great! Now I can write the plugin I wanted to.</p><h4>Closing Notes</h4><ol><li>Harlan Carvey and other great DFIR folks have already <a href="http://windowsir.blogspot.com/2011/08/more-updates.html">discussed</a> the concept of tools “validation”, so I will not say a lot about it. I just want to emphasize how important it is, in my opinion, to understand the <strong>evidence </strong>before we start to use a tool that automatically parses evidence for us.</li><li>I reported the <a href="https://github.com/ydkhatri/mac_apt/issues/16">issue</a> in the mac_apt project page, and Yogesh already provided a fix! I will test it and hopefully send a PR with my plugin.</li><li>I did <a href="https://github.com/search?l=Python&amp;q=import+biplist+forensics&amp;type=Code">a quick check</a>, and it seems that <em>biplist</em> is being used by other macOS DFIR tools, which possibly use it wrongly. It’s worth checking further.</li><li>That was a fun way to start doing macOS forensics. However, I noticed that there aren’t too many test images out there. So:<br> a) If anyone can share some “test images”, that would be great. Please do!<br> b) I’m thinking to manually “compromise” my virtual machine, perform<br> malicious activity on it and image it. Is that something that can be useful for anyone? If the answer is yes — let me know and I will try to work on it.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bf2f5e4956c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/mac-forensics-no-one-said-it-would-be-easy-8bf2f5e4956c">Mac Forensics — No One Said It Would Be Easy</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Regipy: Automating registry forensics with python]]></title>
            <link>https://medium.com/dfir-dudes/regipy-automating-registry-forensics-with-python-b170a1e2b474?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/b170a1e2b474</guid>
            <category><![CDATA[computer-forensics]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[dfir]]></category>
            <dc:creator><![CDATA[martin korman]]></dc:creator>
            <pubDate>Wed, 06 Mar 2019 18:40:50 GMT</pubDate>
            <atom:updated>2019-03-06T18:40:50.695Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately I’ve been doing a lot of forensic investigations and tool development that involve registry hives. I tried a lot of tools, and none of them could satisfy all of my requirements:</p><ul><li>Has JSON output</li><li>Can be used as a python library <strong>with python 3 support</strong> and the following features:</li><li>Recurse over a registry hive from a given path and yield all subkeys and respective values</li><li>Get a subkey by path</li><li>Expose some of the binary structures (NK &amp; VK entries for example)</li><li>Apply transaction logs automatically, and in scale (over hunderds of collected hives and transaction logs)</li><li>Has a plugin system, with an easy and intuitive way to add more plugins</li><li>Can run on any operating system</li><li>Open source</li></ul><p>So I decided to create my own tool.</p><p><strong>Regipy: an OS independent python library for parsing offline registry hives</strong></p><h3>Features:</h3><h4>Multiple command line tools:</h4><ul><li>registry-dump — Dump the entire content of the hive to ndjson. if the -t flag is specified, the output file will be a timeline instead</li><li>registry-parse-header — Parse the REGF header of the file and validate checksum</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oW54eXms-aij1G26.png" /></figure><ul><li>registry-run-plugins — Identify the hive type and run all supported plugins. Output the results as a JSON file.</li><li>Execute the registry-plugins-list command to get a list of supported plugins, for example:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cG7ZAqY6WZQKv3CA.png" /></figure><ul><li>registry-diff — Compare two registry hives (Like regshot tool), and get the output to CSV or to screen:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NLTsrwRqGTASG5ku.png" /></figure><ul><li>registry-transaction-logs — Recover a registry hive, using transaction logs. The restored hive can be then compared to the original hive to see the differences</li></ul><h4>Plugins:</h4><p>It’s really easy to write new plugins, because of all the utils present in regipy. A short example on how to create new plugins can be found <a href="https://github.com/mkorman90/regipy/blob/master/docs/PLUGINS.md"><strong>here</strong></a><strong>. </strong>These are the currently existing plugins:</p><ul><li>Installed services (from system hive)</li><li>Amcache (both win7 and win8+ formats)</li><li>Network routes</li><li>Computer name</li><li>Ntuser hive persistence</li><li>Software hive persistence</li><li>User Assist</li><li>Shimcache (Mandiant’s Shimcache parser)</li><li>Installed software</li><li>Image file execution options</li></ul><h4>Use as a library:</h4><ul><li>Get a specific registry key by path, get all subkeys and values for that key</li><li>Recurse over the registry hive from a given path (or root) and yield all subkeys</li><li>Execute specific plugins</li><li>Apply registry transactions from a log file on a specific hive</li></ul><p>Hopefully, the DFIR community will find this library/tool useful as well.</p><p>I learned a lot about registry structure from working on this project:</p><ul><li>The registry is a complex binary structure with a lot of extreme cases:</li><li>Data can be resident inside the VK record itself, if the data is small enough</li><li>Sometimes the data is small enough and yet it is not resident</li><li>Data bigger than 16344 bytes will be in a different type of structure (i.e: shimcache)</li><li>The transaction logs are really important and can make a great difference between having findings in a case or not.</li></ul><h3>A practical example of analysis using regipy and pandas</h3><p><strong>Load the hive timeline to group by timeframes and detect interesting registry modifications:</strong></p><p>Load the output of registry-dump NTUSER_modified.DAT -t -o ./timeline.csv to pandas:</p><pre>import pandas as pd</pre><pre>pd.set_option(&#39;max_colwidth&#39;, 800)</pre><pre>df = pd.read_csv(&#39;/tmp/testdata/timeline.csv&#39;)</pre><pre>df[&#39;timestamp&#39;] = pd.to_datetime(df[&#39;timestamp&#39;])</pre><pre>df.index = df[&#39;timestamp&#39;]</pre><pre>df.drop(columns=&#39;timestamp&#39;, inplace=True)</pre><pre>df = df.sort_index(ascending=True)</pre><p>We get a dataframe that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*3MakhS51-Sntk5gN.png" /></figure><p>We want to group events by a specific time span, for example 1 hour:</p><pre>df_grouped = df.groupby(pd.Grouper(freq=&#39;60Min&#39;, base=30, label=&#39;right&#39;)).sum()</pre><pre>df_grouped[df_grouped[&#39;values_count&#39;] &gt; 0][df_grouped[&#39;values_count&#39;] &lt; 5]</pre><p>Now we have a small data frame with a couple of interesting timeframes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/0*HnE7xXEWYfoXN8pW.png" /></figure><p>Let’s take a look at a specific timeframe:</p><p>df[df.index &gt;= &#39;2012-04-04 02:30:00+00:00&#39;]</p><p>We get the following result (the result is sorted by date, and only the latest entries are shown):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0wuIzpvvXR6SKhv6.png" /></figure><p>We see that<em> \Software\Microsoft\Windows\CurrentVersion\Run</em> was modified, and also <em>\Software\Microsoft\legitimate_subkey\legitimate_subkey</em>… Interesting :)</p><h4>What’s next?</h4><p>There’s a lot of work to be done:</p><ul><li>Recovering data from unallocated cells</li><li>Improve performance even more (someone said rust?)</li><li>Write more plugins — also expecting some pull requests from the community</li></ul><h3>How to install</h3><p>Regipy supports only python 3.7</p><p>Regipy releases can be found at pypi: <a href="https://pypi.org/project/regipy/">https://pypi.org/project/regipy/</a></p><p>to get the latest stable release just use:</p><pre>pip install regipy</pre><p>The source code is on github: <a href="https://github.com/mkorman90/regipy">https://github.com/mkorman90/regipy</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b170a1e2b474" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/regipy-automating-registry-forensics-with-python-b170a1e2b474">Regipy: Automating registry forensics with python</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StartupInfo: Autoruns served up on a plate]]></title>
            <link>https://medium.com/dfir-dudes/startupinfo-autoruns-served-up-on-a-plate-ba2da0c753c5?source=rss----52c0e984ec3---4</link>
            <guid isPermaLink="false">https://medium.com/p/ba2da0c753c5</guid>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[Hadar Yudovich]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 20:42:15 GMT</pubDate>
            <atom:updated>2018-07-19T21:00:01.847Z</atom:updated>
            <content:encoded><![CDATA[<p>Two weeks ago I found a useful piece of forensic evidence on startup processes. The evidence is an XML formatted file called StartupInfo.xml, located under <em>%WINDIR%\System32\WDI\LogFiles\StartupInfo.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*nd9x76NTQStmDvCs" /></figure><p>As usual, before I started parsing the file or dig further into it, I thought it would be a good idea to first see if anyone has covered this before. Unfortunately I couldn’t find anything online.</p><p>It’s funny how these things are discovered sometimes. While I was going over the last <a href="https://www.sans.org/summit-archives">SANS DFIR Summit’s slides</a>, I saw <a href="https://twitter.com/nicoleibrahim">@nicoleibrahim</a>’s great work about Windows Events Trace Logs (ETLs). In her talk, she discussed different ETLs and one of them was the <em>WdiContextLog.etl,</em> which is also located in <em>%WINDIR%\System32\WDI\LogFiles.</em> As always, when I read about evidence, I compare the information to the data on my own system to see if maybe there’s new stuff to find out about. That’s when I saw the StartupInfo directory which seemed interesting and contained these XML files.</p><p>When I find new stuff, my go-to-guy is my friend Martin (@MartinKorman), so I asked him if he would like to write about it together. These are our findings.</p><p><strong>What is this file?</strong></p><p>The files are located under <em>%WINDIR%\System32\WDI\LogFiles\StartupInfo</em>, in the following format: <em>&lt;USER_SID&gt;/StartupInfo&lt;NUMBER&gt;.xml.</em> The <strong><em>SID </em></strong>part is derived from the user account that logged into the system and the <strong>NUMBER </strong>part is an incremental count of these files, where 5 is the maximum number. Once there are 5 StartupInfo files and a logon occurs, the log rotates and overwrites the least updated file.</p><p>The file is in XML format and contains useful information about a list of processes which were executed on the first 90 seconds since the user has logged in. The information includes the following attributes:</p><ul><li><strong>Process Information</strong> — Name, PID, Start Time, Command Line, Disk Usage, CPU Usage.</li><li><strong>Parent Process Information</strong> — Parent PID, Parent Start Time, Parent Process Name.</li></ul><p>The xml file is written by a svchost process (that has a loaded DLL of Microsoft Performance Diagnostics named diagperf.dll).</p><p>We confirmed this by taking a quick look of the DLL in IDA:</p><p>Here we see the code in diagperf.dll that creates the folder containing the files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/0*1uLfe8eIUv_A7cNX" /></figure><p>These are the some relevant strings inside the DLL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y1jlZ_fhk3sF_tAZ" /></figure><p><strong>Relevant Operating Systems</strong></p><p>According to our tests, these files do not exist on Windows Server, and were only introduced starting Windows 8.</p><p><strong>Is it a valuable forensic artifact ?</strong></p><p>There are already many pieces of forensic evidence that include information about startup processes or process creation. Is this evidence of any value?</p><p>Here are a few ways in which this can be used during an incident response, forensic investigation or for detection in general:</p><ol><li>Like any artifact that is analyzed at scale, a statistical analysis on the process names and command lines can be performed to find the outliers.</li><li>If a malware removes its persistence on boot (and writes it back during shutdown), for example like some variants of Dridex did, you would be able to find it in this artifact.</li><li>Helps mapping user to process — determines under which user’s privileges the process was launched.</li><li>Determines if the process wrote any files to disk (based on the Disk Usage attribute).</li><li>Many more :)</li></ol><p><strong>Parsing</strong></p><p>The evidence is an XML file, encoded in utf-16. It can be parsed easily with lxml. The most effective way to analyze this data in scale would be inside a pandas data frame, using jupyter lab (http://jupyterlab.readthedocs.io/en/stable/).</p><p>You can find the code <a href="https://gist.github.com/mkorman90/272dbc126409135018de3210dd3d2eca">here</a>.</p><p>Below you can find an example of a parsed file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g2pm07p45KUCuOoM" /></figure><p><strong>Summary</strong></p><p>This is a cool new piece of evidence that can be used in DFIR. Instead of going over process creation events or correlating different process startup locations, you can inspect this file and get a good grasp of which processes were executed upon the system’s boot.</p><p>There are additional things or paths to investigate about this evidence, so let us know if you find anything cool about it that we might have missed :)</p><p>Hadar &amp; Martin</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba2da0c753c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dfir-dudes/startupinfo-autoruns-served-up-on-a-plate-ba2da0c753c5">StartupInfo: Autoruns served up on a plate</a> was originally published in <a href="https://medium.com/dfir-dudes">DFIR Dudes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>