// HackTheBox  ·  writeup

ProcNet

HackTheBox Hard tshark7-ZipstringsgrepAPI Monitor
DFIR

Scenario

With the rising utilization of open-source C2 frameworks by threat actors, our red team has simulated the functionalities of one such widely employed framework. The objective of this exercise is to aid blue teams in strengthening their defenses against these specific threats. We have been provided with PCAP files and APIs collected during the event, which will serve as valuable resources. Let us now initiate the hunting process.

Using the API Monitor:

We are well-acquainted with opening PCAP and .EVTX files, but what are .apmx64 ? The .apmx64 file extension is associated with API Monitor, a software used to monitor and control API calls made by applications and services. To commence your analysis, follow the steps provided below:

TIP: When conducting analysis, it is advisable to begin by examining the API calls made by the process itself, rather than focusing solely on DLLs. For instance, if I intend to analyze the API calls of a process named csgo.exe, I will initially expand the view by clicking the ’+’ symbol. Then, I will narrow down my analysis specifically to ‘csgo.exe’ by selecting it, and I can further analyze other DLLs as needed.

Executive Summary

A red team simulated an open-source C2 framework against a workstation and a domain controller. A payload disguised as a game executable was pulled over HTTP from a staging port, then the implant beaconed to an external host over TLS on 443. Through that channel the operator ran a .NET assembly inside a sacrificial process, enumerated the working directory and the Windows credential vault, and listed domain admins with a built-in command. Lateral movement to the domain controller used a WMI tool from the framework’s extension armory, and the NTDS database was dumped with ntdsutil in IFM mode, compressed and downloaded through the implant. The network side gives the C2 address and fingerprint; the API Monitor captures give the operator’s commands.

Artifacts

Tip: An .apmx64 file is a ZIP with a small stub in front. 7z x extracts it and each monitored process gets its own process/N/data file. Both ASCII and UTF-16LE strings are needed because Win32 W APIs log wide strings.

Command and Control

Q1 — To which IP address and port number is the malware attempting to establish a connection ?

Start with conversation statistics on Employee.pcapng. The workstation first fetches an executable over HTTP on port 8080, then opens a long-lived TLS session to a single external host on 443. That second flow is the beacon.

tshark -r Employee.pcapng -q -z conv,tcp
Click flag to reveal 3.6.165.8:443
Q2 — Now that you are aware of the IP address and port number, what is the JA3 fingerprint of the C2 server ?

From Q1 we know the destination. Pull the JA3 hash from the TLS ClientHello sent to that address.

tshark -r Employee.pcapng -Y 'tls.handshake.type == 1 && ip.dst == 3.6.165.8' -T fields -e tls.handshake.ja3

Gotcha: The question says “C2 server”, but JA3 fingerprints the client side of the handshake. The value comes from the ClientHello the implant sends to the server.

Click to reveal answer 19e29534fd49dd27d09234e639c4057e
Q3 — What is the name of the C2 framework being utilized by the red team ?

This one was reasoned rather than read from a single artifact. The traffic profile (an executable staged over HTTP, then a TLS beacon on 443), the commands recovered in the later questions (execute-assembly, a WMI tool from an “armory”) and the format hint of six characters ending in r all point to the same open-source framework. HTB accepted it.

Tip: The armory wording in Q9 is framework-specific vocabulary. Use it as a pivot if the pcap alone doesn’t settle the name.

Click flag to reveal sliver

Execution

Q5 — Now that we have identified the C2 framework utilized by the red team, which C2 command is responsible for opening notepad.exe by default and loading the .NET CLR into it ?

Answered from the framework’s documented behaviour (identified in Q3) rather than from a captured artifact. The command that spawns a sacrificial notepad.exe and loads the CLR into it to run a .NET assembly in memory is execute-assembly. The format mask (seven letters, a hyphen, eight letters ending in y) fits, and HTB accepted it.

Click flag to reveal execute-assembly

Discovery

Q4 — Which WIN32 API provided the red team with the current directory information ?

Unpack the workstation capture and search the raw data of the implant process for the directory API. The W suffix in the format mask means the wide-character variant, so search for that form.

7z x Employee.apmx64 -o x/emp
grep -a -o 'GetCurrentDirectoryW' x/emp/process/0/data | sort | uniq -c
Click to reveal answer GetCurrentDirectoryW
Q8 — Which command did the attacker execute to identify domain admins ?

Dump wide and narrow strings from the extracted API Monitor data and search for domain group queries. The operator used the built-in net command against the Domain Admins group; the /dom switch at the end matches the format mask.

strings -el x/emp/process/*/data | grep -i 'domain admins'
Click flag to reveal net group "domain admins" /dom

Credential Access

Q6 — What is the name of the module (DLL) that was loaded to gain access to Windows Vault ?

The module list for the second monitored process in the workstation capture includes the Windows Vault client library. A search of its data for vaultcli finds it.

grep -a -o -i 'vaultcli\.dll' x/emp/process/1/data | sort | uniq -c
Click to reveal answer vaultcli.dll
Q7 — After loading the mentioned module, there were a series of WIN32 APIs loaded. Which specific Win32 API is responsible for enumerating vaults ?

From Q6, vaultcli.dll is the module. Its exports include a family of Vault* functions; the one that lists the vaults themselves is the enumerate call, which ends in s per the format mask.

grep -a -o 'Vault[A-Za-z]*' x/emp/process/1/data | sort | uniq -c
Click flag to reveal VaultEnumerateVaults
Q10 — Which command was executed by the red team to extract/dump the contents of NTDS.DIT ?

The format mask gives the shape: cmd /c wrapping ntdsutil, quoted ac in ntds and cr fu arguments, and an output path under %TEMP%. Search the capture strings for ntdsutil to get the exact command line, including the dump folder name.

strings -el x/dc/process/*/data | grep -i ntdsutil
Click to reveal answer cmd /c ntdsutil "ac in ntds" ifm "cr fu %TEMP%\H00i0Z000.dat" q q

Lateral Movement

Q9 — The red team has provided us with a hint that they utilized one of the tools from "ARMORY" for lateral movement to DC01. What is the name of the tool ?

This answer was reasoned, not read directly. The DC01.apmx64 capture shows WMI activity on the domain controller, and the format mask (eight characters ending in i) matches an armory extension that runs commands remotely over WMI. HTB accepted it.

Click flag to reveal sharpwmi

Exfiltration

Q11 — The red team has obtained the aforementioned dump by compressing it into a ZIP file. Which specific Win32 API is responsible for retrieving the full path of the file to be downloaded?

This one was inferred from the API name and the format mask (sixteen characters ending in W), not read out of the capture. The wide-character API that turns a relative file name into a full path before the implant reads and sends the file is GetFullPathNameW. HTB accepted it.

Click to reveal answer GetFullPathNameW

Attack Summary

PhaseAction
ExecutionExecutable staged from an HTTP service on port 8080 and run on the workstation
Command and ControlImplant beacons over TLS to an external host on 443
Execution.NET assemblies run inside a sacrificial notepad.exe with the CLR loaded
DiscoveryCurrent directory queried; domain admins listed with net group
Credential Accessvaultcli.dll loaded and Windows vaults enumerated
Lateral MovementWMI-based armory tool used to reach DC01
Credential AccessNTDS database dumped with ntdsutil IFM into %TEMP%
ExfiltrationDump compressed to ZIP and downloaded through the implant

IOCs

TypeValue
C2 address3.6.165[.]8:443
JA319e29534fd49dd27d09234e639c4057e
Staging port8080 (payload csgo.exe)
Dump path%TEMP%\H00i0Z000.dat
Commandnet group "domain admins" /dom

MITRE ATT&CK

TechniqueIDDescription
Ingress Tool TransferT1105Payload fetched over HTTP on port 8080
Application Layer Protocol: Web ProtocolsT1071.001TLS beacon to the C2 host on 443
Reflective Code LoadingT1620.NET assemblies run in memory through a CLR-hosting sacrificial process
File and Directory DiscoveryT1083Current directory retrieved with GetCurrentDirectoryW
Credentials from Password Stores: Windows Credential ManagerT1555.004vaultcli.dll loaded and vaults enumerated
Permission Groups Discovery: Domain GroupsT1069.002net group "domain admins" /dom
Windows Management InstrumentationT1047WMI-based armory tool for lateral movement to DC01
OS Credential Dumping: NTDST1003.003ntdsutil IFM dump of the AD database
Archive Collected DataT1560Dump compressed to ZIP
Exfiltration Over C2 ChannelT1041ZIP downloaded through the implant

Defender Takeaways

A JA3 on a TLS beacon is a cheap, durable network signature. The implant’s ClientHello gave a stable fingerprint toward one external address. Alert on it, or on rare JA3 values leaving workstations, instead of relying on IP reputation alone.

Staging over a non-standard HTTP port is the first visible step. An executable pulled on port 8080 just before a long-lived 443 session is a strong sequence. Proxy or firewall rules that flag executable downloads from raw IPs would have fired before the beacon started.

A sacrificial notepad.exe that loads the CLR is abnormal. Notepad has no reason to load .NET. Monitor for the CLR modules appearing in processes that normally never host managed code.

ntdsutil in IFM mode on a domain controller should page someone. The command line is distinctive and the dump lands in %TEMP%. Alert on ntdsutil with ifm arguments, and on remote WMI execution against DCs from workstations.

Conclusion

The operator went from a single downloaded executable to a full copy of the domain database, using only one outbound TLS channel and built-in Windows tooling on the domain controller. The network layer gave the destination and fingerprint, but the API call data is what showed the actual hands-on activity.