// HackTheBox  ·  writeup

GhostTrace

HackTheBox Easy EvtxECmdPythonVirusTotal
SOC

Scenario

This challenge simulates a sophisticated Active Directory attack involving phishing, privilege escalation, lateral movement, and domain compromise. As a blue team analyst, you must perform forensic analysis to answer questions about the attack. Use tools like Event Viewer, PowerShell, Autopsy, or other forensic utilities to analyze the provided logs and $MFT files. Identify key events such as process creation, network connections, credential dumping, and persistence mechanisms.

Executive Summary

A user on Client02 downloaded a macro-enabled Word document from an internal attacker host and opened it, which called back to a listener and pulled down a second-stage executable that opened a reverse shell. The attacker used PowerShell to fetch PowerView, enumerated the domain and requested a Kerberos service ticket for a service account, then logged on to Client03 with the cracked credentials. A Sysinternals-style remote service gave them execution there, and a renamed Mimikatz exposed another user’s cleartext password. That account ran a DCSync against the domain controller, after which the attacker authenticated as Administrator on DC01 and left a service, a scheduled task and a Run key behind.

Artifacts

Timestamp note: Three questions need YYYY-MM-DD hh:mm:ss in UTC. EvtxECmd output is already UTC, so copy the time as shown.

Initial Access

Q1 — What is the name of the malicious phishing attachment downloaded by the user on Client02?

Start with the Client02 Sysmon channel. File-create (event 11) and stream-create (event 15) records show Chrome writing a single document into the jody user’s Downloads folder. The .docm extension means macros, which is what a phishing attachment needs.

EvtxECmd -d Logs-Client02 --csv work/evtx

Tip: Event 15 (FileCreateStreamHash) fires for the Zone.Identifier stream Chrome adds, so it points at downloaded files directly.

Click flag to reveal Profits.docm
Q2 — What is the IP address from which the malicious attachment was downloaded?

The Zone.Identifier stream hash recorded for the document includes its HostUrl, the URL the file came from. It points to a plain HTTP server on an internal address, which is the attacker’s host.

grep -i 'HostUrl' work/evtx/Client02.csv | grep -i Profits.docm
Click to reveal answer 192.168.204.152

Execution

Q3 — After the victim opened the file the malware initiated a network connections to a remote IP address. What is the IP address and the port number?

Sysmon event 3 on Client02 shows WINWORD.EXE itself making an outbound connection at 03:29:06, which is the macro calling home. The destination is the same host that served the document (Q2), on a classic listener port.

grep 'WINWORD.EXE' work/evtx/Client02.csv | grep -i 'NetworkConnect'
Click flag to reveal 192.168.204.152:4444
Q4 — What is the name of the second-stage payload uploaded to Client02?

PowerShell script block logging (event 4104) on Client02 records an Invoke-WebRequest that saves an executable into Downloads. That is the second stage, fetched after the first-stage callback in Q3.

grep 'Invoke-WebRequest' work/evtx/Client02.csv | grep -i Downloads
Click to reveal answer UpdatePolicy.exe

Command and Control

Q5 — What port was used for the reverse shell connection from the second-stage payload on Client02?

Pivot from the Q4 filename to Sysmon event 3. UpdatePolicy.exe connects back to the same attacker IP, but on a different port than the Word macro used in Q3.

grep 'UpdatePolicy.exe' work/evtx/Client02.csv | grep -i 'NetworkConnect'
Click flag to reveal 1337

Discovery

Q6 — The attacker subsequently downloaded a tool to enumerate the Active Directory environment. What is the name of this tool?

Back in the 4104 script blocks on Client02, a second Invoke-WebRequest pulls a PowerShell script rather than an executable. The later cmdlets (Get-DomainUser, Get-DomainSPNTicket) are PowerView functions, which confirms the tool.

grep '4104' work/evtx/Client02.csv | grep -i PowerView
Click to reveal answer PowerView.ps1

Credential Access

Q7 — What is the username of the targeted service account?

The PowerView session in Q6 runs Get-DomainUser -Identity <name> | Get-DomainSPNTicket, which is a Kerberoast request for one named account. The domain controller backs it with a matching service-ticket event (4769) for the same account.

grep 'Get-DomainSPNTicket' work/evtx/Client02.csv
Click flag to reveal sqlsvc

Lateral Movement

Q8 — After acquiring the account credentials, the attacker was able to crack the ticket. When did the attacker first use them to log in? (UTC)

Hunt logon events (4624) and NTLM validations (4776) for sqlsvc. The first hit is a failed logon around 03:49. The successful network logon (type 3) on Client03 is what the question wants.

grep -E 'sqlsvc' work/evtx/Client03.csv | grep -E '4624|4625'

Gotcha: The earlier 03:49 attempts failed. The first use of the cracked credentials that counts is the first successful 4624.

Click to reveal answer 2025-05-25 04:03:47
Q9 — What is the executable associated with the first service created by a Sysinternals tool on the target system following the attacker's initial login attempt?

On Client03, look at Sysmon registry events (13) under Services after the 04:03:47 logon. The first new service appears at 04:05:12, with an ImagePath of %systemroot%\ plus a random-looking executable name.

grep 'ImagePath' work/evtx/Client03.csv | grep -i 'systemroot'

Gotcha: PsExec normally leaves PSEXESVC.exe. This service and its binary have random names, the pattern of an Impacket-style psexec clone, so searching for PSEXESVC finds nothing.

Click flag to reveal VgYTbFEK.exe

Credential Access

Q10 — On Client03, what was the file name of the executable used to dump cleartext credentials from memory?

Build a Sysmon process-creation (event 1) timeline for Client03 after the service in Q9 and look for an unfamiliar binary. netdiag.exe stands out, and its SHA256 in VirusTotal resolves to Mimikatz, so the name is a masquerade.

grep 'netdiag.exe' work/evtx/Client03.csv
bin/vt 92804FAA...

Tip: The hash is cut here. Take the full SHA256 from the Sysmon event 1 record when you look it up.

Click to reveal answer netdiag.exe
Q11 — What is the username of the account whose cleartext password was found on Client03?

The log does not print the dumped password, so this one was reasoned rather than read from an artifact. Client03’s PowerShell history shows runas /user:Main\lucas, which only makes sense once the password is known, and lucas is the account that performs the DCSync in Q12. HTB accepted it.

grep -i 'runas' work/evtx/Client03.csv
Click flag to reveal lucas
Q12 — After obtaining the cleartext password of this account, the attacker carried out a domain-level credential extraction attack. At what time did the compromised account perform this attack on the domain? (UTC)

A DCSync shows on the domain controller as event 4662 (directory service access) from a non-DC account. Filter DC01 for 4662 by MAIN\lucas.

grep '4662' work/evtx/DC01.csv | grep -i lucas
Click to reveal answer 2025-05-25 04:26:36

Privilege Escalation

Q13 — At what time did the attacker initially authenticate using the administrator account? (UTC)

The DCSync yields the Administrator hash. On DC01, take the first 4624 for Administrator after the Q12 time.

grep '4624' work/evtx/DC01.csv | grep -i Administrator
Click flag to reveal 2025-05-25 04:34:01

Persistence

Q14 — What is the name of the service created by the attacker on DC01 for persistence?

Process-creation auditing (4688) on DC01 captures an sc create command line after the Administrator logon. The service name is the first argument.

grep '4688' work/evtx/DC01.csv | grep -i 'sc create'
Click to reveal answer WindowsUpdateSvc
Q15 — What is the name of the scheduled task created by the attacker on DC01 for persistence?

Two sources agree: a 4698 (scheduled task created) event and a schtasks /create command line in the same process-creation log. Both carry the task name.

grep -E '4698|schtasks' work/evtx/DC01.csv | grep -i create
Click flag to reveal WindowsUpdateCheck
Q16 — What is the registry key name created by the attacker on DC01 for persistence?

A reg add against HKCU Run in the DC01 process-creation log. The name HTB wants is the value name passed with /v.

grep '4688' work/evtx/DC01.csv | grep -i 'reg add'

Gotcha: The question says registry key, but the answer is the Run value name set with /v, not the Run key path.

Click to reveal answer xcvafctr

Attack Summary

PhaseAction
Initial Accessjody downloads a macro document from an internal attacker web server via Chrome
ExecutionWord connects back to the attacker on the first listener port
ExecutionSecond-stage executable downloaded with PowerShell
Command and ControlSecond stage opens a reverse shell on a different port
DiscoveryPowerView fetched and used to enumerate the domain
Credential AccessKerberoast request for the sqlsvc service account
Lateral MovementCracked sqlsvc credentials used for a network logon to Client03
Lateral MovementSysinternals-style remote service with a random name created on Client03
Credential AccessRenamed Mimikatz run on Client03; lucas password recovered
Credential Accesslucas runs DCSync against the domain
Privilege EscalationAttacker authenticates to DC01 as Administrator
PersistenceService, scheduled task and Run value created on DC01

Forensic Timeline

Timestamp (UTC)Event
03:29:06 (date not recorded)WINWORD.EXE connects to the attacker on port 4444
2025-05-25 04:03:47First successful sqlsvc logon on Client03, after failed attempts around 03:49
04:05:12 (date not recorded)Random-name service created on Client03
2025-05-25 04:26:36MAIN\lucas performs DCSync (4662)
2025-05-25 04:34:01First Administrator logon on DC01

IOCs

TypeValue
IP192.168.204[.]152
Ports4444 (macro callback), 1337 (reverse shell)
FileProfits.docm (C:\Users\jody\Downloads\)
FileUpdatePolicy.exe
FilePowerView.ps1
Filenetdiag.exe (renamed Mimikatz)
File%systemroot%\VgYTbFEK.exe (remote service binary on Client03)
Accountsqlsvc (Kerberoasted), lucas (DCSync), Administrator
ServiceWindowsUpdateSvc (DC01)
Scheduled taskWindowsUpdateCheck (DC01)
RegistryHKCU Run value xcvafctr (DC01)

MITRE ATT&CK

TechniqueIDDescription
Phishing: Spearphishing AttachmentT1566.001Macro document delivered to jody
User Execution: Malicious FileT1204.002Document opened, macro called back
Ingress Tool TransferT1105Second stage and PowerView pulled with Invoke-WebRequest
Command and Scripting Interpreter: PowerShellT1059.001PowerShell download and PowerView use
Account Discovery: Domain AccountT1087.002PowerView domain enumeration
Steal or Forge Kerberos Tickets: KerberoastingT1558.003SPN ticket requested for sqlsvc
Valid Accounts: Domain AccountsT1078.002sqlsvc, lucas and Administrator logons
System Services: Service ExecutionT1569.002Remote service on Client03
Masquerading: Match Legitimate Name or LocationT1036.005Mimikatz renamed netdiag.exe
OS Credential Dumping: LSASS MemoryT1003.001Cleartext credentials dumped on Client03
OS Credential Dumping: DCSyncT1003.006lucas replicates directory secrets
Create or Modify System Process: Windows ServiceT1543.003WindowsUpdateSvc on DC01
Scheduled Task/Job: Scheduled TaskT1053.005WindowsUpdateCheck on DC01
Boot or Logon Autostart: Registry Run KeysT1547.001Run value xcvafctr on DC01

Defender Takeaways

Block and alert on macro documents that arrive over plain HTTP. The document came straight from an internal host with a Zone.Identifier HostUrl, then Word opened an outbound connection of its own. Block macros from the internet zone, and alert on WINWORD.EXE making any network connection (Sysmon event 3).

Service accounts with SPNs need strong passwords and ticket-request monitoring. A single Get-DomainSPNTicket for sqlsvc led to cracked credentials. Use long random passwords or gMSAs, and alert on 4769 requests for RC4 tickets against service accounts.

Name-based detection of Sysinternals tools misses clones. The remote service on Client03 had a random name and binary, so a PSEXESVC rule would stay silent. Detect on service installs (7045 or Sysmon 13 under Services) whose ImagePath is a random executable in %systemroot% right after a network logon.

A renamed credential dumper is still caught by hash and behaviour. netdiag.exe was Mimikatz under another name. Enable LSASS access auditing and hash reputation checks, and keep WDigest off so cleartext passwords are not there to dump.

DCSync and DC persistence should page someone. 4662 with the replication GUIDs from a non-DC account, followed by a new service, task and Run value on the domain controller within minutes, is a complete compromise pattern. Alert on each, and restrict replication rights to domain controllers.

Conclusion

A single phished macro document led to full domain compromise in about an hour, with the attacker holding Administrator on DC01 and three persistence mechanisms planted. Every hop left a Sysmon or Security event, so the gap was missing alerting on the chain, not missing logs.