{"id":8860,"date":"2021-12-18T21:30:00","date_gmt":"2021-12-18T19:30:00","guid":{"rendered":"https:\/\/tajdini.net\/blog\/?p=8860"},"modified":"2022-03-23T21:54:22","modified_gmt":"2022-03-23T19:54:22","slug":"incident-response-without-windows-event-logs","status":"publish","type":"post","link":"https:\/\/tajdini.net\/blog\/dfir-and-incident-response\/incident-response-without-windows-event-logs\/","title":{"rendered":"Incident Response without Windows Event Logs"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This post discuss some Digital Forensics and Incident Response (DFIR) techniques you can leverage when you encounter an environment <strong>without Windows event logs<\/strong>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Where are the logs?<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">at work, we regularly respond to security <strong>incidents with ineffective logging<\/strong> and auditing for the purposes of a cyber incident. In some cases, organisations we encounter don\u2019t have any recognisable SIEM or centralised log repository. In others, organisations with otherwise sufficient logging have seen <strong>adversaries intentionally manipulate the logs on an endpoint to prevent analysis<\/strong> \u2013 sometimes even wiping them entirely.\u00a0<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Clearing the event logs on a Windows machine is trivial. It is a recognised behaviour of adversaries [<a rel=\"noreferrer noopener\" href=\"https:\/\/attack.mitre.org\/techniques\/T1070\/001\/\" target=\"_blank\">T1070.001<\/a>] who wish to evade and frustrate investigators\u2019 efforts to unravel the TTPs of a malicious campaign. Without the event logs on a machine, you cannot use beautiful tools <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/countercept\/chainsaw\" target=\"_blank\">like Chainsaw<\/a> to easily piece together the story for your client.\u00a0<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Thankfully, our guidance is relevant to all situations where logs are unavailable to support an investigation.&nbsp;<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Log-less investigations<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">For the rest of this post, I would like us to<strong> operate under a log-free paradigm \u2013 where the event logs cannot be utilized in an investigation<\/strong>. I\u2019d like us to discuss <strong>three<\/strong> DFIR techniques that you can easily deploy when next conducting analysis on a machine that an adversary has tampered with. The machine may or may not have the required logs, or you may not trust the evidence \u2013 meaning we must verify past events through other means.\u00a0\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we do not have the permanency that event logs offer, we are left with volatile forensic data. Simply put, <strong>if you do not get to most forensic data as quickly as possible then it may be gone forever<\/strong>. If the machine is rebooted, the data can be lost; if the machine is left on and is used, many pieces of forensic evidence may be overwritten and lost forever.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are many techniques for digital forensics. To understand and deploy the more advanced tools, there are many wise sages who I would recommend, such as <a href=\"https:\/\/www.youtube.com\/channel\/UCy8ntxFEudOCRZYT1f7ya9Q\">Richard Davis\u2019 13Cubed<\/a>. In particular, there are three (or <strong>four, if you\u2019re feeling brave<\/strong>) post-log techniques I consider to have a <strong>low barrier<\/strong> to entry in terms of technical capability, have general <strong>resiliency<\/strong> to adversarial manipulation, and are <strong>relevant<\/strong> to Windows endpoints and servers:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/labs.jumpsec.com\/no-logs-no-problem-incident-response-without-windows-event-logs\/#PSReadLine\"><strong>PSReadLine<\/strong><\/a> (PowerShell History)<\/li><li><a href=\"https:\/\/labs.jumpsec.com\/no-logs-no-problem-incident-response-without-windows-event-logs\/#prefetch\"><strong>Prefetch<\/strong><\/a> (PEcmd)<\/li><li><a href=\"https:\/\/labs.jumpsec.com\/no-logs-no-problem-incident-response-without-windows-event-logs\/#shimcache\"><strong>Shimcache<\/strong><\/a> (AppCompatcache)<\/li><li>BONUS: <a href=\"https:\/\/labs.jumpsec.com\/no-logs-no-problem-incident-response-without-windows-event-logs\/#usn-journal\"><strong>USN Journal<\/strong><\/a> (via Velociraptor)<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"PSReadLine\">PSReadLine<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>This first one is a technique I do not see discussed that much<\/strong>. And I\u2019m not sure why. It has definitely illuminated parts of an attack that were once a mystery to me in the early stages of an investigation. The only detailed post I can find is <a href=\"https:\/\/community.sophos.com\/sophos-labs\/b\/blog\/posts\/powershell-command-history-forensics\" target=\"_blank\" rel=\"noreferrer noopener\">a blog by Sophos<\/a>, but I find it lacks some of the operational guidance that an investigator needs.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/psreadline\/?view=powershell-7.2\">PsReadLine is a PowerShell module<\/a> that can do lots of cool things. Most pertinent for our conversation is its ability to <strong>offer insight into the history of the PowerShell<\/strong> commands previously run.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we run some commands, we can instantly recall them via history (this isn\u2019t the DFIR part, I promise).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"330\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/unnamed-file-1024x330-2861697.png\" alt=\"\" class=\"wp-image-8861\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/unnamed-file-1024x330-2861697.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/unnamed-file-1024x330-2861697-300x97.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/unnamed-file-1024x330-2861697-768x248.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">However, if the machine is rebooted (<code>Restart-Computer<\/code>), or the history cleared (<code>Clear-History<\/code>) then that history is lost.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"955\" height=\"166\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/2-7086258.png\" alt=\"\" class=\"wp-image-8862\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/2-7086258.png 955w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/2-7086258-300x52.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/2-7086258-768x133.png 768w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"135\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/3-4195792.png\" alt=\"\" class=\"wp-image-8863\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/3-4195792.png 680w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/3-4195792-300x60.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, running the history command<strong> will only return the history of the current user and session<\/strong> \u2013 so other users who sign into the machine and run commands will remain a mystery\u2026 <em>Or maybe not?<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">PSReadLine: Retrieve PowerShell History<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PSReadLine will save the <a href=\"https:\/\/social.technet.microsoft.com\/Forums\/en-US\/7c3cd614-f793-4b99-b826-3dff917ebe88\/powershell-commands-history-windows-10-1809-psreadline?forum=win10itprogeneral#:~:text=By%20default%2C%20the%20PowerShell%20in,separately%20for%20PowerShell%20and%20ISE.\" target=\"_blank\" rel=\"noreferrer noopener\">last four thousand commands<\/a> a user has run into a particular file. <strong>If you query each users\u2019 <em>ConsoleHost_history.txt<\/em>, you can retrieve these commands.&nbsp;<\/strong> get-content C:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadline\\ConsoleHost_history.txt<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"211\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/4-edited-3369808-1024x211.png\" alt=\"\" class=\"wp-image-8864\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/4-edited-3369808-1024x211.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/4-edited-3369808-300x62.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/4-edited-3369808-768x158.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/4-edited-3369808.png 1378w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here, we can see the commands I ran above. These were <strong>previously lost<\/strong> to us when the machine was rebooted and\/or the history wiped\u2026<strong> but here they are available for us <\/strong>to piece together what the adversary did!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I wouldn\u2019t want you to have to manually do this for every user\u2019s history \u2013 that would waste your precious time! On an endpoint, we can <strong>run a quick loop<\/strong> that will print every user <em>ConsoleHost_history<\/em> file: $Users = (Gci C:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadline\\ConsoleHost_history.txt).FullName;$Pasts = @($Users);foreach ($Past in $Pasts) { write-host &#8220;`n&#8212;-User Pwsh History Path $Past&#8212;&#8221; -ForegroundColor Magenta; get-content $Past}<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"288\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/5-edited-1-8354469-1024x288.png\" alt=\"\" class=\"wp-image-8865\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/5-edited-1-8354469-1024x288.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/5-edited-1-8354469-300x85.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/5-edited-1-8354469-768x216.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/5-edited-1-8354469.png 1356w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From our short script, in the pink text we\u2019ve printed the users\u2019 Console History file. This will snitch on last four thousand commands from each <strong>user account<\/strong>. We can also see that in the red arrow and box <strong>Frank\u2019s account <\/strong>is highlighted for <strong>deploying Mimikatz! <\/strong>Below Frank\u2019s commands, we can see the IEUser\u2019s PowerShell history begins to also be printed.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This was the first technique to trace the steps of the adversary. But keep in mind some caveats:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, an attacker may just delete this file as part of their clean up operation;&nbsp;<\/li><li>Second, it will only record PowerShell \u2013 not cmd or wmic;&nbsp;<\/li><li>Third, it will only record up to 4096 PowerShell commands;&nbsp;<\/li><li>and finally,<strong> the console host history text file will <a href=\"https:\/\/www.cloudsavvyit.com\/8722\/using-psreadline-in-powershell\/\" target=\"_blank\" rel=\"noreferrer noopener\">not be available on all Windows OS\u2019 and builds<\/a><\/strong><a href=\"https:\/\/www.cloudsavvyit.com\/8722\/using-psreadline-in-powershell\/\"><strong>.<\/strong><\/a><\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"prefetch\">Prefetch<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">If you go to the directory C:\\Windows\\Prefetch on a Windows <strong>endpoint<\/strong>, you\u2019re in for a treat.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Prefetch (also known as prefetcher) is <strong>a caching technique <\/strong>whereby an application is monitored and catalogued for the first few seconds it is launched, to make <strong>re-launching more efficient.&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If this sounds like something awesome for a log-less investigation, then you\u2019re right!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you sort by the prefetch files recently written to,<strong> you can see the executables recently deployed by both the user and the computer itself.<\/strong> dir &#8216;C:\\Windows\\Prefetch&#8217; | sort LastWriteTime -desc<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/6-1024x683-11912.png\" alt=\"\" class=\"wp-image-8866\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/6-1024x683-11912.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/6-1024x683-11912-300x200.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/6-1024x683-11912-768x512.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/6-1024x683-11912-360x240.png 360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If we look very closely at the prefetch files (.PF), we can see that <strong>Mimikatz<\/strong> makes a special guest appearance!! This <strong>evidences that Mimikatz has been executed<\/strong>, but we don\u2019t get any more context from the name of the prefetch file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"621\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/7-edited-1-8836191.png\" alt=\"\" class=\"wp-image-8867\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/7-edited-1-8836191.png 622w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/7-edited-1-8836191-300x300.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/7-edited-1-8836191-150x150.png 150w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Prefetch: PECmd<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The contents of a prefetch file cannot be simply read to gather more execution context! This is where <a href=\"https:\/\/github.com\/EricZimmerman\/PECmd\">Eric Zimmerman\u2019s PEcmd<\/a> comes to save the day.<strong> This tool will carve through the prefetch directory or a prefetch file<\/strong>, and<strong> make it easier for investigators<\/strong> to see the discrete info about the prefetched data.&nbsp; # I\u2019d advise picking the -f flag, and picking on one of the prefetch files you see in the directory.\\PECmd .exe -f &#8216;C:\\Windows\\prefetch\\MIMIKATZ.EXE-599C44B5.pf&#8217; #get granular timestamps by adding -mp flag.\\PECmd .exe -f &#8216;C:\\Windows\\prefetch\\MIMIKATZ.EXE-599C44B5.pf&#8217; -mp# If you don\u2019t know what file you want to process, get the whole directory. Will be noisy though and I wouldn\u2019t recommend.\\PECmd .exe -d &#8216;C:\\Windows\\Prefetch&#8217; &#8211;csv . #dot at the end means write in current directory<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"416\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/8-edited-4423704-1024x416.png\" alt=\"\" class=\"wp-image-8868\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/8-edited-4423704-1024x416.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/8-edited-4423704-300x122.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/8-edited-4423704-768x312.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/8-edited-4423704.png 1343w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You get a whole load more with PECmd. Let\u2019s look in more detail at what you\u2019re given.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we can see the various times associated with this executable (creation, modification etc). We\u2019re also told about the executable name and file size. Interestingly, on the last line <strong>we can see the amount of times the executable has been run<\/strong> (once, on our instance) as well as the time it was last run.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"318\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/9-2913415.png\" alt=\"\" class=\"wp-image-8869\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/9-2913415.png 790w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/9-2913415-300x121.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/9-2913415-768x309.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we are given<strong> insight into the directories and then the files that were involved in this execution<\/strong> \u2013 this is again another excellent way to better map the granular behaviour the adversary had during their attack.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"973\" height=\"273\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/10-7782970.png\" alt=\"\" class=\"wp-image-8870\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/10-7782970.png 973w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/10-7782970-300x84.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/10-7782970-768x215.png 768w\" sizes=\"auto, (max-width: 973px) 100vw, 973px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Note that Eric Zimmerman is kind enough to highlight the offending executable.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/11-1024x433-9933033.png\" alt=\"\" class=\"wp-image-8871\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/11-1024x433-9933033.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/11-1024x433-9933033-300x127.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/11-1024x433-9933033-768x325.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">There are some caveats for this second technique:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, prefetch exists from Windows XP onwards, but PEcmd <strong>will only work from Windows 8 above;<\/strong><\/li><li>Second, <strong>you don\u2019t retrieve the arguments or parameters used <\/strong>and so can only know the base executable that the adversary leveraged;<\/li><li>Third, the relevancy of prefetch is <strong>time-based<\/strong> \u2013 so if you do not collect it after an incident and the machine continues to be used then you may lose the evidence;<\/li><li>Fourth and most important, <strong>prefetch has to be enabled on servers, as <a href=\"https:\/\/www.forensicfocus.com\/forums\/mobile-forensics\/prefetch-on-windows-servers\/#:~:text=1.-,Is%20there%20a%20technical%20reason%20that%20this%20is%20off%3F,like%2C%20well%E2%80%A6running%20applications.\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft disables recording prefetch on Windows servers by default<\/a>. It is enabled on normal Windows endpoints. <\/strong>You can <strong><a href=\"https:\/\/truesecdev.wordpress.com\/2015\/11\/25\/how-to-enable-prefetch-in-windows-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">enable prefetch recording<\/a> <\/strong>with the following on a Windows Server:<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">reg add &#8220;HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\PrefetchParameters&#8221; \/v EnablePrefetcher \/t REG_DWORD \/d 3 \/f; reg add &#8220;HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Prefetcher&#8221; \/v MaxPrefetchFiles \/t REG_DWORD \/d 8192 \/f; Enable-MMAgent \u2013OperationAPI; net start sysmain<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"shimcache\">Shimcache<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.fireeye.com\/content\/dam\/fireeye-www\/services\/freeware\/shimcache-whitepaper.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Shimcache<\/a> analysis is our third technique to gather insight into an attacker\u2019s past activities.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Shimcache \u2013 called AppCompatCache on a Windows machine \u2013 was originally made to determine interoperability issues between Windows versions and applications.\u00a0 Like prefetch, we can leverage shimcache to identify evidence of execution on a machine when we do not have event logs.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/ericzimmerman.github.io\/#!index.md\" target=\"_blank\" rel=\"noreferrer noopener\">Another Eric Zimmerman tool<\/a> called <strong>AppCompatCacheParser<\/strong> can give us insight into what was run on the system.&nbsp; .\\AppCompatCacheParser.exe -t &#8211;csv . &#8211;csvf shimcache.csv<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"242\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/12-edited-3088891-1024x242.png\" alt=\"\" class=\"wp-image-8872\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/12-edited-3088891-1024x242.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/12-edited-3088891-300x71.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/12-edited-3088891-768x181.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/12-edited-3088891.png 1419w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will create a CSV, which you could import to your spreadsheet of choice\u2026 but some quick PowerShell can give you some visibility. There will be a lot of noise here, but if we filter through we can find something quite interesting. import-csv .\\shimcache.csv | sort lastmodified -Descending | fl path,last*<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"235\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/13-edited-4074426-1024x235.png\" alt=\"\" class=\"wp-image-8873\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/13-edited-4074426-1024x235.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/13-edited-4074426-300x69.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/13-edited-4074426-768x176.png 768w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/13-edited-4074426.png 1195w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Despite not having access to the event logs, if we query<strong> shimcache we can see proof of Mimikatz\u2019 execution<\/strong>, once again. Shimcache is a relatively straightforward artefact to query. It does however have <strong>some complications<\/strong>, as its implementation varies in Windows versions over the years. And again, if an investigator is not quick enough to gather the shimcache data then it may be lost!<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"usn-journal\">BONUS: USN Journal<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">The USN journal isn\u2019t as easy an artefact to investigate as it is <strong>extremely<\/strong> <strong>verbose. <\/strong>I\u2019ve included it as <strong>a bonus fourth tip<\/strong>, in case the above three techniques fail to deliver you any insight for your log-less investigation.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The USN journal leverages some of the artefacts we have previously encountered (like prefetch). <strong>It also can reach much further back<\/strong> into the past, compared to other volatile artefacts, and identify files that were long deleted \u2013 excellent for DFIR purposes [<a href=\"https:\/\/www.youtube.com\/watch?v=1mwiShxREm8\" target=\"_blank\" rel=\"noreferrer noopener\">1<\/a>, <a href=\"https:\/\/www.youtube.com\/watch?v=_qElVZJqlGY\" target=\"_blank\" rel=\"noreferrer noopener\">2<\/a>].<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/Velocidex\/velociraptor\" target=\"_blank\" rel=\"noreferrer noopener\">Dr Michael Cohen\u2019s Velociraptor<\/a> is an excellent tool to help us leverage the USN journal to see what an adversary did. Fortunately, there is <a href=\"https:\/\/velociraptor.velocidex.com\/carving-usn-journal-entries-72d5c66971da\" target=\"_blank\" rel=\"noreferrer noopener\">a dedicated blog<\/a> that offers step-by-step advice on how best to leverage Velociraptor to hunt USN details.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>I\u2019d recommend Velociraptor for its low technical barrier<\/strong> to <a href=\"https:\/\/www.hackingarticles.in\/threat-hunting-velociraptor-for-endpoint-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\">deploy many other advanced forensic techniques<\/a>, including prefetch hunts.<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">USN Journal: Velociraptor<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We can download Velociraptor on a machine we are investigating and launch it straight there \u2013 n<strong>o need to set up any server-client infrastructure<\/strong>, when in an emergency:&nbsp; velociraptor.exe gui #spin this up as admin<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"395\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/14-1024x395-7587771.png\" alt=\"\" class=\"wp-image-8874\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/14-1024x395-7587771.png 1024w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/14-1024x395-7587771-300x116.png 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/14-1024x395-7587771-768x296.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The web browser will pop up, and we will be met with Velociraptor\u2019s GUI. We can traverse to the main hunting page and name our hunt. We can then pick the <strong>USN<\/strong> <strong>forensic<\/strong> <strong>hunt<\/strong>, and fire it off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whilst the results are being collected and parsed, we can write some VQL (<a href=\"https:\/\/velociraptor.velocidex.com\/the-velociraptor-query-language-pt-1-d721bff100bf\" target=\"_blank\" rel=\"noreferrer noopener\">Velociraptor Query Language<\/a>) to <strong>sort the results by timestamp<\/strong>, and filter out some other headers we don\u2019t care about:&nbsp; SELECT Usn,Timestamp,Filename,Fullpath,FileAttributes,Reason,SourceInfo FROM source()ORDER BY Timestamp desc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our USN journal results, we can see <strong>the relics of a Mimikatz<\/strong> execution, along with the timestamp that we can use to map the adversaries timeline.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"420\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/15-edited-1-2812838.png\" alt=\"\" class=\"wp-image-8875\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/15-edited-1-2812838.png 672w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/15-edited-1-2812838-300x188.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, the USN journal is often <strong>challenging to navigate when used in a real life incident.<\/strong> My arbitrary example with Mimikatz doesn\u2019t quite convey the <strong>complexity<\/strong> and <strong>verbosity<\/strong> that you will face when leveraging the USN journal in a real investigation. For example, in our artificial scenario, just<strong> a few runs <\/strong>of Mimikatz resulted in near <strong>97 rows <\/strong>in the USN journal,via Velociraptor.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"288\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/16-757321.png\" alt=\"\" class=\"wp-image-8876\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/16-757321.png 761w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/03\/16-757321-300x114.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">Burn the logs, see if I care!<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">This has been an overview into a number of <strong>easy to use, highly-reliable, rapid digital forensics techniques<\/strong>. I have found these techniques<strong> useful in investigations where the event logs can no longer be trusted or accessed <\/strong>due to adversarial tampering, or perhaps where <strong>logging was not set up<\/strong> in the first place by the client.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post discuss some Digital Forensics and Incident Response (DFIR) techniques you can leverage when you encounter an environment without Windows event logs. Where are the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8877,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[224,230],"tags":[120,179,246,184,230],"class_list":["post-8860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dfir-and-incident-response","category-penetration-testing","tag-auditing","tag-dfir","tag-digital-forensics","tag-incident-response","tag-penetration-testing"],"_links":{"self":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/comments?post=8860"}],"version-history":[{"count":1,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8860\/revisions"}],"predecessor-version":[{"id":8878,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8860\/revisions\/8878"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/media\/8877"}],"wp:attachment":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/media?parent=8860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/categories?post=8860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/tags?post=8860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}