API hooking traces are the ground truth of behavior: every file opened, registry key set, process created, and packet sent, with arguments and timestamps. The skill is reading them at the right altitude: too high and you miss the technique, too low and you drown in millions of calls. This sub-skill covers filtering, argument reading, sequence recognition, and trace-to-detection conversion. Scope: analyze only traces from samples you are authorized to handle, captured in an isolated lab, during authorized DFIR or malware research.
Quick Workflow
- Get the trace (sandbox JSON, ProcMon PML, or debugger log) and note its size and process list.
- Filter by category: process, file, registry, network, in that order of technique value.
- For each category, extract the state-changing calls with arguments.
- Match call sequences to technique primitives (section 3).
- Resolve any hashed or unnamed APIs to real names.
- Build the per-process timeline and the cross-process story.
- Write argument-level IOCs and detection logic.
1. Filtering traces by category
# CAPE JSON: calls per process per category
jq -r '.behavior.processes[] |
"\(.process_name) pid=\(.pid) calls=\(.calls | length)"' report.json
# ProcMon: filter in the GUI or export CSV and filter with python
# Keep: CreateFile, WriteFile, RegSetValue, Process Create, TCP Connect
# Drop: ReadFile on system DLLs, RegQueryValue on benign keys, thread exits
Example output shape:
sample.exe pid=2140 calls=48210
powershell.exe pid=2210 calls=1204
rundll32.exe pid=2330 calls=88
The 48k-call process is the dropper doing setup noise; the 88-call rundll32 is the payload doing the real work. Read the small one first: technique density is highest where call count is lowest.
2. Reading arguments: the IOC layer
# Files written (dropped payloads)
jq -r '.behavior.processes[].calls[] |
select(.api == "CreateFileW" and (.arguments.creation_disposition |
contains("CREATE"))) | .arguments.filepath' report.json | sort -u
# Registry writes (persistence)
jq -r '.behavior.processes[].calls[] |
select(.api == "RegSetValueExW") |
"\(.arguments.regkey) = \(.arguments.value_name)"' report.json | sort -u
Example output shape:
C:\Users\analyst\AppData\Local\Temp\pay.dll
HKCU\Software\Microsoft\Windows\CurrentVersion\Run = NimbusSync
Arguments are the IOCs; the API name is the technique. Always capture both. Note return values too: a CreateFile that returned INVALID_HANDLE_VALUE means the drop failed, which changes the story.
3. Technique primitive sequences
Memorize these shapes; they are the vocabulary:
Process hollowing:
CreateProcessW (CREATE_SUSPENDED) -> NtUnmapViewOfSection ->
WriteProcessMemory -> SetThreadContext -> ResumeThread
Classic injection:
OpenProcess -> VirtualAllocEx -> WriteProcessMemory ->
CreateRemoteThread
APC injection:
OpenProcess -> OpenThread -> VirtualAllocEx ->
WriteProcessMemory -> QueueUserAPC
Credential access (LSASS):
OpenProcess(lsass.exe) -> MiniDumpWriteDump / direct memory read
Defense disable:
RegSetValueEx (...Windows Defender...) / sc stop / net stop
When you see the first two calls of a sequence, jump ahead and check for the rest; a partial sequence (alloc plus write, no execute) means the injection failed or was interrupted, which is itself a finding.
4. Hashed and unnamed APIs
API-hashed malware shows resolved addresses instead of names in some tracers, or calls through registers. Resolution tactics:
- Break on the resolver in the debugger and log the hash-to-name mapping as it runs.
- Match call patterns: a call preceded by hash 0x5BA3... in a known family is a known API; keep a family hash table.
- Use the arguments: a call with (PROCESS_ALL_ACCESS, pid) is OpenProcess regardless of its name.
Trace excerpt with hashing:
call 0x7FFA... (hash 0x8F1A2B3C) args=(0x1FFFFF, 0, 1232)
-> OpenProcess(PROCESS_ALL_ACCESS, FALSE, 1232): LSASS pid, credential theft
Document each resolved mapping; the next trace from this family reuses them.
5. Trace to timeline to detection
Build the timeline from filtered calls (parent skill section 5), then write the detection at argument level:
title: Nimbus Run key persistence
detection:
selection:
EventID: 13
TargetObject|endswith: '\CurrentVersion\Run\NimbusSync'
condition: selection
Argument-level detections (exact value names, exact paths) are precise but brittle; pair each with a behavior-level variant (any Run key write by rundll32 with a Temp path) for variant coverage.
Edge cases
- Traces with millions of calls: sample or filter harder; never try to read raw.
- Multi-threaded malware: interleave by timestamp, not by log order; log order across threads is misleading.
- Calls that fail: check return values before concluding a technique succeeded.
- Tracer blind spots: some sandboxes miss direct syscalls; cross-check with memory forensics when behavior is suspected but unlogged.
- Time skew between processes: normalize to a single clock before merging timelines.
Escalation
If the trace shows syscalls with no API names and you cannot resolve them, escalate to debugger-based tracing for that process.
If argument values contain victim PII, escalate handling per incident rules before sharing the trace.
If the tracer itself is detected and the sample alters behavior, escalate to a different tracing method (ETW, hypervisor) and compare.
If traces must be shared externally, sanitize hostnames and user paths first; escalate handling if victim PII is present.
Detection and defender view
API traces are where behavior detections are born: the exact sequence plus argument patterns become Sigma rules and EDR hunt queries. Keep a library of primitive sequences mapped to ATT&CK so junior analysts can match traces quickly. When a detection fires in production, the trace from the lab is the reference for what the analyst should expect to see; link lab traces in detection documentation.
Key references
CAPE Sandbox reporting documentation: https://capev2.readthedocs.io/
Process Monitor documentation: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
MITRE ATT&CK: T1055 (Process Injection), T1547.001 (Registry Run Keys), T1003 (OS Credential Dumping)
Sigma specification: https://github.com/SigmaHQ/sigma
Microsoft ETW documentation: https://learn.microsoft.com/en-us/windows/win32/etw/about-event-tracing
