HackTheBox Sherlock: Threat Hunting with Splunk

11 Nov 2026 · Sherlock · 6 min
Sherlock
Threat Hunting with Splunk
Platform
HackTheBox
Category
Threat Hunting
Difficulty
Medium
Released
1 Oct 2026
Rating
★5.0 / 5.0
Table of Contents

Overview

This lab simulates a compromised Windows host where a user ran a fake PDF, application_form.pdf.exe, downloaded from an external web server. The file was a trojan that opened a reverse connection to the attacker, spawned cmd.exe, ran discovery commands, created a backdoor account and pulled down a PowerShell script for post-exploitation. The only data source is Sysmon telemetry in Splunk, so every answer is found by pivoting between Sysmon event IDs.

I used the following Sysmon events during the hunt:

Event ID Name Used For
1 Process Creation Finding the trojan, cmd.exe activity, user creation and the execution policy bypass
3 Network Connection Finding the C2 address and port
11 File Create Finding when the file landed on disk and the dropped script
13 Registry Value Set Finding the firewall rule
15 File Create Stream Hash Finding the download URL

Table 1: Sysmon event IDs used in this writeup

All searches use the same base, so I only repeat it where it matters:

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"

Task 1: Full Path of the Malicious File

What is the full path of the file that likely provided remote access?

I started with Event ID 1 (Process Creation). Malware often runs a shell or script interpreter, so I looked for those binaries being started by a parent process in a user-writable folder. The parent is the interesting part: the answer is the process that launched the shell, not the shell itself.

  • EventCode=1 limits the search to process creation.
  • ParentImage is matched against \Downloads\, \AppData\, \Temp\ and \Users\Public\, the locations malware is usually launched from.
  • Image IN (...) limits results to common living-off-the-land binaries (cmd.exe, powershell.exe, wscript.exe and so on).
  • table puts the useful fields in columns so the results are easier to read.
sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(ParentImage="*\\Downloads\\*" OR ParentImage="*\\AppData\\*" OR ParentImage="*\\Temp\\*" OR ParentImage="*\\Users\\Public\\*")
Image IN ("*\\cmd.exe","*\\powershell.exe","*\\pwsh.exe","*\\wscript.exe","*\\cscript.exe","*\\mshta.exe","*\\rundll32.exe","*\\regsvr32.exe")
| table _time host User ParentImage ParentCommandLine Image CommandLine IntegrityLevel
The Downloads folder executable launching cmd.exe

The Downloads folder executable launching cmd.exe

The double extension .pdf.exe is a classic trick: Windows hides known extensions by default, so the victim sees a PDF icon and a PDF-looking name.

Answer: C:\Users\LetsDefend\Downloads\application_form.pdf.exe

Task 2: File Creation Time

When was this file created on the disk?

Event ID 11 (File Create) records every file written to disk, so I searched it for the filename.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 *application_form.pdf.exe*
| table _time TargetFilename
File creation event for application_form.pdf.exe

File creation event for application_form.pdf.exe

Answer: 2024-06-06 09:24:11

Task 3: Download URL

What URL was the file downloaded from?

Event ID 15 (File Create Stream Hash) is logged when a file gets an alternate data stream. When a browser saves a download, Windows adds a Zone.Identifier stream (the Mark of the Web), and Sysmon records its contents, including the HostUrl the file came from. I read the Contents field.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=15 TargetFilename="*application_form.pdf.exe*"
| table _time Contents
Zone.Identifier contents showing the download URL

Zone.Identifier contents showing the download URL

Answer: http://13.232.55.12:8080/application_form.pdf.exe

Task 4: C2 IP Address and Port

What is the IP and port used for C2 communication?

Event ID 3 (Network Connection) shows which process opened a connection and where to. I filtered on the trojan as the source process.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=3 Image="*\\application_form.pdf.exe"
| table _time Image DestinationIp DestinationPort
Network connection from the trojan to the C2 server

Network connection from the trojan to the C2 server

The C2 server is the same host the file was downloaded from, but on a different port than the web server (8080).

Answer: 13.232.55.12:30

Task 5: Trojan Spawning cmd.exe

The trojan executed cmd and started a command prompt session. When did this activity occur?

Back to Event ID 1, this time with the trojan as ParentImage and cmd.exe as the child.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 ParentImage="*\\application_form.pdf.exe" Image="*\\cmd.exe"
| table _time ParentImage CommandLine ParentProcessGuid ProcessGuid
The trojan spawning cmd.exe

The trojan spawning cmd.exe

I also added ProcessGuid to the table. This GUID uniquely identifies the cmd.exe session, which is what the next task pivots on.

Answer: 2024-06-06 09:28:55

Task 6: Second Command in the Session

What was the second command the attacker ran in that command prompt?

Every process Sysmon logs has a ProcessGuid, and its children carry that value as ParentProcessGuid. Searching for the cmd.exe GUID from Task 5 lists everything that session started, in order.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 ParentProcessGuid="*EE8CCBDD-8157-6661-DB02-000000000300*"
| table _time ParentImage Image CommandLine
| sort _time
Commands started by the attacker's cmd.exe session

Commands started by the attacker's cmd.exe session

Answer: tasklist

Task 7: New Backdoor Account

The attacker added a new user to establish persistent access. What is the username/password pair?

Accounts are created from the command line with net user <name> <password> /add, so I searched process creation for that pattern.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="*net*user*/add*"
| table _time CommandLine
net user command creating the backdoor account

net user command creating the backdoor account

Answer: jumpadmin:U7gk54skuvhs@1

Task 8: Post-Exploitation Script

The attacker downloaded a script for further post-exploitation. What is the full path to the script on the local system?

A downloaded PowerShell script has to be written to disk by something, so I looked for Event ID 11 where the creating process is powershell.exe.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 Image="*\\powershell.exe"
| table _time TargetFilename
PowerShell writing a script to disk

PowerShell writing a script to disk

Answer: C:\Windows\Temp\tmp.ps1

Task 9: PowerShell Execution Policy Bypass

When did the attacker bypass the PowerShell execution policy?

The execution policy is normally bypassed with the -ExecutionPolicy Bypass argument, so I searched process creation command lines for bypass.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="*bypass*"
| table _time CommandLine
PowerShell started with the execution policy bypassed

PowerShell started with the execution policy bypassed

Answer: 2024-06-06 09:42:08

Task 10: Firewall Rule Name

After the alert, the system administrator changed the firewall rules to stop the attacker. What was the name of the rule that was added?

Windows stores firewall rules in the registry, so adding one shows up as Event ID 13 (Registry Value Set) with Firewall in the target path.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=13 TargetObject=*Firewall*
| table _time TargetObject Details
Registry value written for the new firewall rule

Registry value written for the new firewall rule

Answer: secevent1

Task 11: User Context of the Rule

What was the user context/permissions that enforced the policy/rule?

Same search, with the User field added.

sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=13 TargetObject=*Firewall*
| table _time Details User
User account that wrote the firewall rule

User account that wrote the firewall rule

The rule was written by the Windows firewall service rather than by an interactive account, which is why a service identity shows up here.

Answer: NT AUTHORITY\LOCAL SERVICE

← Back to HackTheBox Sherlocks