Tracer Sherlock Walkthrough
PsExec lateral movement investigation over nine incidents: PSEXESVC service installs, key files and named pipes correlated through Hayabusa JSON timelines.
Solved Tracer from Hack The Box!
Attack Timeline
| Timestamp (UTC) | Event | Evidence Source |
|---|---|---|
| 2023-09-07 11:53:02 | First PsExec execution — PSEXESVC service installed on Forela-Wkstn002 | Hayabusa / System.evtx (EID 7045) |
| 2023-09-07 11:55:44 | Second PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 11:57:43 | Third PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 11:57:53 | Fourth PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 12:06:54 | Fifth PsExec execution — key file PSEXEC-FORELA-WKSTN001-95F03CFE.key created, named pipe \PSEXESVC-FORELA-WKSTN001-3056-stderr connected |
System.evtx (EID 7045), Sysmon (EID 11, 18) |
| 2023-09-07 12:08:23 | Sixth PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 12:08:54 | Seventh PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 12:09:09 | Eighth PsExec execution | System.evtx (EID 7045) |
| 2023-09-07 12:10:03 | Ninth (last) PsExec execution | System.evtx (EID 7045) |
Key observation: An attacker used PsExec 9 times over a ~17-minute window (11:53–12:10 UTC) against workstation Forela-Wkstn002.forela.local, installing the PSEXESVC service each time to execute commands remotely. The activity pattern shows two bursts — an initial probe phase (11:53–11:57) and a more intensive phase (12:06–12:10).
Scenario: A junior SOC analyst on duty has reported multiple alerts indicating the presence of PsExec on a workstation. They verified the alerts and escalated the alerts to tier II. As an Incident responder, you triaged the endpoint for artifacts of interest. Now, please answer the questions regarding this security event so you can report it to your incident manager.
Tools used: Hayabusa, jq, PECmd (Eric Zimmerman)
Q1 — How many times was PsExec executed by the attacker on the system?
Answer: 9
We used Hayabusa to generate a JSON timeline from all EVTX logs and then filtered for PsExec-related detections:
$ cat haya_timeline_tracer.json | jq '.RuleTitle' | grep -i "psexec" | sort | uniq -c
Hayabusa flagged five distinct PsExec-related rule categories. The key rule for answering this question is “PSExec Lateral Movement” — which detects Event ID 7045 (new service installation) for the PSEXESVC service. Each time PsExec is used against a target machine, it installs this service to facilitate remote command execution.
We extracted the timeline of all 9 lateral movement events:
$ cat haya_timeline_tracer.json | jq 'select(.RuleTitle == "PSExec Lateral Movement") | "\(.Timestamp) --> \(.Computer) --> \(.EventID) --> \(.Details.Svc)"'
The full JSON detail of one event confirms the service properties:
Key indicators:
- 9 installations of the
PSEXESVCservice over a ~17-minute window (11:53:02–12:10:03 UTC) - Event ID 7045 (System log) records new service installations — this is the canonical indicator for PsExec usage on a target machine
- Service properties:
PSEXESVC, path%SystemRoot%\\PSEXESVC.exe, accountLocalSystem, start typedemand start— all standard PsExec service characteristics - The target workstation is Forela-Wkstn002.forela.local
- Two distinct activity bursts suggest the attacker paused between 11:57 and 12:06, possibly analyzing output or pivoting
- MITRE ATT&CK: T1570 (Lateral Tool Transfer), T1021.002 (Remote Services: SMB/Windows Admin Shares), T1569.002 (System Services: Service Execution)
Q2 — What is the name of the service binary dropped by PsExec tool allowing attacker to execute remote commands?
Answer: psexecsvc.exe
We filtered the Hayabusa timeline for the “PsExec Service File Creation” rule, which detects Sysmon Event ID 11 (FileCreate) for the PsExec service binary:
$ cat haya_timeline_tracer.json | jq 'select(.RuleTitle == "PsExec Service File Creation") | "Timestamp: \(.Timestamp) | Computer: \(.Computer) |EventID: \(.EventID) | ServiceName: \(.Details.Path) | User: \(.ExtraFieldInfo.User)"'
Key indicators:
- The service binary
PSEXESVC.exewas dropped toC:\Windows\on the target machine — this is the standard location where PsExec copies its service component - Sysmon Event ID 11 (File Creation) captures the file being written to disk, correlating with the 9 service installations seen in Q1
- The file is created under the *NT AUTHORITY context, as the PsExec service runs with SYSTEM privileges
- PsExec’s workflow: the attacker runs PsExec from a remote machine → PsExec copies
PSEXESVC.exeto the target’sADMIN$share (C:\Windows\) via SMB → installs and starts it as a service → the service executes the attacker’s commands -** MITRE ATT&CK:** T1570 (Lateral Tool Transfer), T1569.002 (System Services: Service Execution)
Q3 — Now we have confirmed that PsExec ran multiple times, we are particularly interested in the 5th Last instance of the PsExec. What is the timestamp when the PsExec Service binary ran?
Answer: 07/09/2023 12:06:54
Using the same “PsExec Service File Creation” query from Q2, we sorted the results chronologically to identify the 5th instance:
$ cat haya_timeline_tracer.json | jq 'select(.RuleTitle == "PsExec Service File Creation") | "Timestamp: \(.Timestamp) | Computer: \(.Computer) |EventID: \(.EventID) | ServiceName: \(.Details.Path) | User: \(.ExtraFieldInfo.User)"' | sort
The 9 PsExec service file creation events sorted chronologically:
Key indicators:
- The 5th execution at 12:06:54 UTC marks the start of the second burst of PsExec activity, following a ~9 minute gap after the 4th execution (11:57:53)
- This gap could indicate the attacker was analyzing results from the first 4 executions before resuming with more aggressive activity
- The second burst (executions 5–9) is more rapid and concentrated, with 5 executions in ~3 minutes, suggesting the attacker had found what they were looking for and was now actively operating
Q4 — Can you confirm the hostname of the workstation from which attacker moved laterally?
Answer: Forela-Wkstn001
We filtered for the “Psexec Execution” rule (which had only 2 hits) and extracted the command line details:
$ cat haya_timeline_tracer.json | jq 'select(.RuleTitle == "Psexec Execution") | "Timestamp: \(.Timestamp) | CmdLine: \(.Details.Cmdline)"'
The command line reveals:
C:\Users\Administrator\Downloads\PSTools\PsExec64.exe \\Forela-Wkstn001 -u Administrator -i whoami
Key indicators:
- The attacker ran
PsExec64.exefromC:\Users\Administrator\Downloads\PSTools\— the PSTools suite was downloaded to the Administrator’s Downloads folder, not installed via a package manager, indicating manual deployment - The target
\\Forela-Wkstn001in the command line identifies the source workstation from which the attacker moved laterally — remember, we are analyzing artifacts from Forela-Wkstn002 (the target), so the PsExec command line shows the attacker reaching back to Wkstn001 - The
-u Administratorflag indicates the attacker used the Administrator account for lateral movement - The
-i whoamicommand is a classic credential validation technique — the attacker tested if the credentials work before running more invasive commands - The PSTools path under
Downloadssuggests the attacker downloaded the Sysinternals PsExec tool to the compromised machine rather than using a pre-installed copy - MITRE ATT&CK: T1021.002 (Remote Services: SMB/Windows Admin Shares), T1059.001 (Command and Scripting Interpreter: PowerShell/Cmd), T1078 (Valid Accounts)
Q5 — What is the full name of the Key File dropped by the 5th last instance of PsExec?
Answer: PSEXEC-FORELA-WKSTN001-95F03CFE.key
We filtered for the “PSEXEC Remote Execution File Artefact” rule, which detects key files dropped by PsExec during remote execution, and sorted chronologically:
$ cat haya_timeline_tracer.json | jq 'select(.RuleTitle == "PSEXEC Remote Execution File Artefact") | "Timestamp: \(.Timestamp) | Key: \(.Details.Path)"' | sort
q5_psexec_key_file.png
The 9 key files sorted chronologically:
| # | Timestamp (UTC) | Key File |
|---|---|---|
| 1 | 11:53:02 | PSEXEC-FORELA-WKSTN001-8B11A519.key |
| 2 | 11:55:44 | PSEXEC-FORELA-WKSTN001-EDCC783C.key |
| 3 | 11:57:43 | PSEXEC-FORELA-WKSTN001-7AA5D6C6.key |
| 4 | 11:57:53 | PSEXEC-FORELA-WKSTN001-663BCB85.key |
| 5 | 12:06:55 | PSEXEC-FORELA-WKSTN001-95F03CFE.key |
| 6 | 12:08:23 | PSEXEC-FORELA-WKSTN001-C3E84A44.key |
| 7 | 12:08:54 | PSEXEC-FORELA-WKSTN001-415385DF.key |
| 8 | 12:09:09 | PSEXEC-FORELA-WKSTN001-89A517EE.key |
| 9 | 12:10:03 | PSEXEC-FORELA-WKSTN001-CAD5E7EF.key |
Key indicators:
- PsExec creates a
.keyfile inC:\Windows\for each remote execution session — these are used as named pipe synchronization tokens between the PsExec client and the PSEXESVC service - The key file naming convention is
PSEXEC-<SOURCE_HOSTNAME>-<RANDOM_HEX>.key, which further confirms Forela-Wkstn001 as the source machine (consistent with Q4) - Each key file has a unique hex identifier, correlating 1:1 with each PsExec execution session
- These key files are valuable forensic artifacts — even if event logs are cleared, residual
.keyfiles on disk can prove PsExec was used and identify the source hostname - MITRE ATT&CK: T1570 (Lateral Tool Transfer), T1021.002 (Remote Services: SMB/Windows Admin Shares)
Q6 — Can you confirm the timestamp when this key file was created on disk?
Answer: 07/09/2023 12:06:55
This was already identified in Q5. The Hayabusa timeline for the “PSEXEC Remote Execution File Artefact” rule shows the 5th key file PSEXEC-FORELA-WKSTN001-95F03CFE.key was created at 2023-09-07 12:06:55 UTC — just 1 second after the corresponding PSEXESVC service installation at 12:06:54 (Q3).
Key indicators:
- The ~1 second delta between service installation (12:06:54, EID 7045) and key file creation (12:06:55, EID 11) is consistent with PsExec’s normal execution flow: install service → start service → create key file → execute command
- This tight correlation across two different event sources (System log and Sysmon) provides strong forensic confidence in the timeline
Q7 — What is the full name of the Named Pipe ending with the “stderr” keyword for the 5th last instance of the PsExec?
Answer: \PSEXESVC-FORELA-WKSTN001-3056-stderr
PsExec uses Named Pipes for inter-process communication between the client and the remote PSEXESVC service. For each session, three pipes are created: one for stdin, one for stdout, and one for stderr. We queried the Sysmon logs for Event ID 18 (PipeEvent — Pipe Connected) and filtered for the stderr pipes:
$ cat sysmon.json | jq '.[] | select(.Event.System.EventID == 18) | "Timestamp:\(.Event.System.TimeCreated_attributes.SystemTime) | PipeName:\(.Event.EventData.PipeName)"' | sort | grep stderr
q7_psexec_named_pipes_stderr.png
The 9 stderr named pipes sorted chronologically:
| # | Timestamp (UTC) | Named Pipe |
|---|---|---|
| 1 | 11:53:02 | -FORELA-WKSTN001-7460-stderr |
| 2 | 11:55:44 | -FORELA-WKSTN001-2304-stderr |
| 3 | 11:57:43 | -FORELA-WKSTN001-6328-stderr |
| 4 | 11:57:53 | -FORELA-WKSTN001-7460-stderr |
| 5 | 12:06:55 | -FORELA-WKSTN001-3056-stderr |
| 6 | 12:08:23 | -FORELA-WKSTN001-1164-stderr |
| 7 | 12:08:54 | -FORELA-WKSTN001-7356-stderr |
| 8 | 12:09:09 | -FORELA-WKSTN001-6196-stderr |
| 9 | 12:10:03 | -FORELA-WKSTN001-7396-stderr |
Key indicators:
- Sysmon Event ID 18 (PipeEvent — Pipe Connected) captures named pipe connections, which are critical forensic artifacts for PsExec detection
- The named pipe naming convention is
\PSEXESVC-<SOURCE_HOSTNAME>-<PID>-<stream>, where PID is the process ID on the remote host and stream isstdin,stdout, orstderr - The 5th instance pipe
\PSEXESVC-FORELA-WKSTN001-3056-stderrcorresponds to PID 3056 on the target machine, which was the process spawned by the 5th PsExec execution at 12:06:55 UTC - The source hostname FORELA-WKSTN001 in the pipe name is consistent with findings from Q4 and Q5
- Named pipes persist as forensic evidence even when command output is not logged — they prove a bidirectional communication channel existed between the attacker and the target
- MITRE ATT&CK: T1021.002 (Remote Services: SMB/Windows Admin Shares), T1570 (Lateral Tool Transfer)