| name | capa |
| description | Auth/lab ref: capa capability detection; executable/sandbox triage, MITRE/MBC mapping, behavior summary, static review prioritization. |
| license | Apache-2.0 |
| compatibility | Windows/Linux/macOS; standalone binary or Python. |
| metadata | {"author":"AeonDave","version":"2.0"} |
capa
Static capability detection for binaries — maps code behavior to ATT&CK/MBC without execution.
Installation
wget https://github.com/mandiant/capa/releases/latest/download/capa-v7.x.x-linux.zip
unzip capa-*.zip && chmod +x capa
pip install capa
capa --version
Basic Usage
capa suspicious.exe
capa -v suspicious.exe
capa -vv suspicious.exe
capa --format sc32 shellcode_32bit.bin
capa --format sc64 shellcode_64bit.bin
capa suspicious.elf
capa dotnet_malware.exe
capa -j suspicious.exe > capa_result.json
capa -j suspicious.exe | jq '.
# Dynamic analysis report (CAPE/sandbox JSON)
capa report.json
# Disable ASLR/PE analysis for raw shellcode
capa --format sc32 payload.bin
Output Interpretation
Standard output structure
+------------------------+---+
| md5 | abc123... |
| sha1 | def456... |
| sha256 | ghi789... |
| path | suspicious.exe |
| size | 45056 |
| arch | x86 |
| os | windows |
| format | pe |
| ... | |
+------------------------+---+
+----------------------------------------------------------------------+------+
| CAPABILITY | N/A |
|----------------------------------------------------------------------+------|
| create process (2 matches) | ✓ |
| write file (3 matches) | ✓ |
| connect to URL (1 match) | ✓ |
| schedule task via at | ✓ |
| create thread (1 match) | ✓ |
+----------------------------------------------------------------------+------+
ATT&CK output section
ATT&CK Tactic ATT&CK Technique
Execution T1059.003 Windows Command Shell
Persistence T1053.005 Scheduled Task/Job: Scheduled Task
Defense Evasion T1055.001 Process Injection: DLL Injection
Command and Control T1071.001 Application Layer Protocol: Web Protocols
MBC output section (Malware Behavior Catalog)
MBC Objective MBC Behavior
Anti-Analysis Software Packing (F0001)
Communication HTTP Communication (C0002)
Execution Execute Code (B0024)
Key Capabilities to Watch For
| Capability | Implication |
|---|
inject into process | Process injection — DLL/shellcode injection |
allocate RWX memory | Shellcode staging area |
write to process memory | Code injection target |
create remote thread | Remote thread injection |
hide process | Rootkit behavior |
hook API | API hooking (keylogger, AMSI bypass) |
connect to URL / send HTTP request | C2 communication |
resolve API by hash | Obfuscated API calls (common in loaders) |
enumerate processes | Discovery / targeting |
schedule task / modify registry run key | Persistence |
dump credentials | Credential harvesting |
read credentials from browser | Browser credential theft |
encrypt data using AES | Data encryption (ransomware, C2) |
decode data using Base64 | Encoded payload / C2 data |
Workflows
Workflow 1: Quick binary triage
capa malware.exe 2>/dev/null
capa malware.exe | grep -i "pack\|obfuscat\|encrypt"
upx -d malware_packed.exe -o malware_unpacked.exe
capa malware_unpacked.exe
capa -j malware.exe > analysis.json
Workflow 2: API hash resolution detection
capa -v malware.exe | grep -i "hash\|resolve\|GetProcAddress"
Workflow 3: Understand malware before RE
capa -vv malware.exe > capa_full.txt
grep "0x" capa_full.txt | grep -i "inject\|encrypt\|connect"
Workflow 4: Classify sample type
capa sample.exe 2>/dev/null | grep -E "download|inject|persist|dump|keylog|encrypt"
Workflow 5: AV/EDR evasion research
capa -vv malware.exe | grep -i "hook\|amsi\|etw\|patch\|bypass"
capa -v malware.exe | grep -i "VirtualAlloc\|WriteProcessMemory\|CreateRemoteThread"
capa -j legit_tool.exe > clean.json
capa -j evasive_tool.exe > evasive.json
diff <(jq '.capabilities | keys[]' clean.json | sort) <(jq '.capabilities | keys[]' evasive.json | sort)
Dynamic Analysis (Sandbox Reports)
capa supports CAPE sandbox JSON output for dynamic capability extraction:
capa report.json --format cape
JSON Output and Parsing
capa -j malware.exe | tee capa.json
capa -j malware.exe | jq '.capabilities | keys[]'
capa -j malware.exe | jq '.attack | .[] | .[] | .id'
capa -j malware.exe | jq '.rules[] | select(.name | contains("inject")) | .matches | keys[]'
capa -j malware.exe | jq '.rules[] | {name: .name, count: (.matches | length)}'
Integration with RE Tools
capa malware.exe -v > capa_output.txt
grep "0x" capa_output.txt | head -20
Rule Customization
git clone https://github.com/mandiant/capa-rules
capa --rules /path/to/custom-rules malware.exe
capa --rules /path/to/capa-rules --rules /path/to/custom-rules malware.exe
capa rule format (YAML):
rule:
meta:
name: detect custom packer
namespace: anti-analysis/packer
att&ck:
- Defense Evasion::Obfuscated Files or Information [T1027]
features:
- and:
- mnemonic: pushad
- mnemonic: popad
- number: 0x1000
Tips
capa cannot see into packed/encrypted code — unpack first (UPX, custom) then re-run
-vv output shows exact VA addresses → use as RE starting points in Ghidra/r2
- "resolve API by hash" = obfuscated imports → look for
GetProcAddress + hash computation
- Dynamic sandbox report mode finds runtime-only behaviors static mode misses
- Compare capa JSON output of malware family variants to find common capabilities across samples
Resources
| File | When to load |
|---|
references/ | Capability interpretation guide, RE pivot strategy, sandbox report setup |