<?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[Stories by Hadar Yudovich on Medium]]></title>
        <description><![CDATA[Stories by Hadar Yudovich on Medium]]></description>
        <link>https://medium.com/@hadaryudovich?source=rss-d6c2728ecb8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mE2fd1ADWJzHWCiuNQi0hQ.png</url>
            <title>Stories by Hadar Yudovich on Medium</title>
            <link>https://medium.com/@hadaryudovich?source=rss-d6c2728ecb8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 11:26:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hadaryudovich/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[KAPEing for fun and profit]]></title>
            <link>https://medium.com/dfir-dudes/kapeing-for-fun-and-profit-85e1f7ee3152?source=rss-d6c2728ecb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/85e1f7ee3152</guid>
            <dc:creator><![CDATA[Hadar Yudovich]]></dc:creator>
            <pubDate>Fri, 05 Apr 2019 23:09:12 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-d6c2728ecb8b------2</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[StartupInfo: Autoruns served up on a plate]]></title>
            <link>https://medium.com/dfir-dudes/startupinfo-autoruns-served-up-on-a-plate-ba2da0c753c5?source=rss-d6c2728ecb8b------2</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:14 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>