Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when analyzing binary structure, disassembling code, or decompiling functions. Deep static analysis via radare2 (r2) and Ghidra headless - function enumeration, cross-references (xrefs), decompilation, control flow graphs. Keywords - "disassemble", "decompile", "what does this function do", "find functions", "analyze code", "r2", "ghidra", "pdg", "afl"
.claude/skills/aiskillstore-binary-re-static-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 43% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 203% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 129% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 269% | 0% |
Understand binary structure and logic without execution. Map functions, trace data flow, decompile critical code.
CRITICAL: Before diving into disassembly, check if known inputs/outputs exist.
⚠️ REQUIRES HUMAN APPROVAL - Get explicit approval before any execution, even for I/O comparison.
bash# SAFE: Use emulation for cross-arch binaries (after human approval) # ARM32: qemu-arm -L /usr/arm-linux-gnueabihf -- ./binary < input.txt > actual.txt # ARM64: qemu-aarch64 -L /usr/aarch64-linux-gnu -- ./binary < input.txt > actual.txt # Docker-based (macOS/cross-arch - see dynamic-analysis Option D): docker run --rm --platform linux/arm/v7 -v ~/samples:/work:ro \ arm32v7/debian:bullseye-slim sh -c '/work/binary < /work/input.txt' > actual.txt # x86-64 native (still requires approval): ./binary < input.txt > actual.txt # Compare outputs: diff expected.txt actual.txt cmp -l expected.txt actual.txt | head -20 # Byte-level differences # Record findings: # - Where does output first diverge? # - Does file size match? (logic bug vs truncation) # - What pattern appears in corruption?
This step often reveals the bug category before any code analysis.
Stage 1 (Light): Function enumeration, strings, imports - fast, broad coverage Stage 2 (Deep): Targeted decompilation, CFG analysis - slow, focused
| Binary Size | Command | Tradeoff | |-------------|---------|----------| | < 500KB | aaa | Full analysis, may be slow | | 500KB - 5MB | aa; aac | Functions + all call targets | | > 5MB | aa + targeted af @addr | Fast, manual depth control |
bash# Launch r2 with controlled analysis r2 -q0 -e scr.color=false -e anal.timeout=120 -e anal.maxsize=67108864 binary # Inside r2 (choose based on binary size): aa # Basic analysis aac # Also analyze all call targets (recommended for most binaries)
Critical settings:
anal.timeout=120 - Prevent runaway analysisanal.maxsize=67108864 - 64MB max function sizeaa; aac for medium binaries, aaa only for small onesIf axtj returns empty for known imports:
bash# The import may be called indirectly or analysis was too shallow # Option 1: Deeper analysis aac # Analyze all calls # Option 2: Manually create function at call target af @0x8048abc # Option 3: Search for references to import address axtj @sym.imp.connect
bash# All functions as JSON aflj # Filter by name pattern aflj~main aflj~init aflj~network aflj~send aflj~recv # Function count afl~?
bash# Who calls this function? axtj @sym.imp.connect # What does this function call? axfj @sym.main # Data references to address axtj @0x12345
bash# Find which function contains a string izj~api.vendor.com # Note the vaddr, then find containing function afi @0xVADDR # Or search and map "/j api" # Search for string axtj @@hit* # Xrefs to all hits
bash# Imports with addresses iij # Exports with addresses iEj # Symbols (if not stripped) isj
bash# Disassemble function as JSON pdfj @sym.main # Disassemble N instructions from address pdj 20 @0x8400 # Print function summary afi @sym.main
Before attempting decompilation, verify r2ghidra is installed:
bash# Check if r2ghidra is available r2 -qc 'pdg?' - 2>/dev/null | grep -q Usage && echo "r2ghidra OK" || echo "SKIP: r2ghidra not installed" # If missing, install with: r2pm -ci r2ghidra
If r2ghidra unavailable: Rely on disassembly (pdf) and cross-reference analysis (axt/axf).
bash# Decompile specific function pdgj @sym.target_function # Or named function pdgj @sym.main
For complex functions or when r2ghidra struggles:
bash# Create analysis project and run script analyzeHeadless /tmp/ghidra_proj proj \ -import binary \ -overwrite \ -processor ARM:LE:32:v7 \ -postScript ExportDecompilation.java sym.target_function \ -deleteProject
Processor strings:
ARM:LE:32:v7 or ARM:LE:32:CortexAARCH64:LE:64:v8Ax86:LE:64:defaultMIPS:LE:32:defaultMIPS:BE:32:defaultbash# Basic blocks in function afbj @sym.main # Function call graph (dot format) agCd @sym.main > callgraph.dot # Control flow graph agfd @sym.main > cfg.dot
bash# Analyze local variables afvj @sym.main # Stack frame layout afvd @sym.main # Global data references adrj
bash# Find all network-related calls axtj @sym.imp.socket axtj @sym.imp.connect axtj @sym.imp.send axtj @sym.imp.recv axtj @sym.imp.SSL_read axtj @sym.imp.SSL_write # Trace caller chain for func in $(aflj | jq -r '.[].name'); do axfj @$func | grep -q "socket\|connect" && echo $func done
bash# Find file operations axtj @sym.imp.open axtj @sym.imp.fopen # Trace string arguments "/j /etc" "/j .conf" "/j .json" # Check what functions reference these paths
bash# Common crypto imports axtj @sym.imp.EVP_EncryptInit axtj @sym.imp.AES_encrypt axtj @sym.imp.SHA256 # Hardcoded keys (check strings near crypto calls) izj | jq '.strings[] | select(.length == 16 or .length == 32)'
| Command | Output | Use Case | |---------|--------|----------| | aflj | Functions list | Map code structure | | axtj @addr | Xrefs TO address | Who uses this? | | axfj @addr | Xrefs FROM address | What does it call? | | pdfj @addr | Disassembly | Understand instructions | | pdgj @addr | Decompilation | Pseudo-C output | | afbj @addr | Basic blocks | Control flow | | izj | Data strings | Configuration, URLs | | iij | Imports | External dependencies | | iEj | Exports | Public interface | | afvj @addr | Local variables | Stack analysis |
Record analysis findings as structured facts:
json{ "functions_analyzed": [ { "name": "sub_8400", "address": "0x8400", "size": 256, "calls": ["socket", "connect", "send"], "called_by": ["main", "init_network"], "strings_referenced": ["api.vendor.com"], "hypothesis": "network_initialization" } ], "call_graph": { "main": ["init_config", "init_network", "main_loop"], "init_network": ["sub_8400", "SSL_CTX_new"] }, "data_flow": [ { "source": "config_file_read", "through": ["parse_config", "extract_url"], "sink": "connect_to_server" } ] }
After static analysis, record findings for episodic memory:
[BINARY-RE:static] {filename} (sha256: {hash})
Functions analyzed: {count}
Decompilation performed: {yes|no}
Key functions:
FACT: Function at {addr} calls {imports} (source: r2 axfj)
FACT: Function at {addr} references string "{string}" (source: r2 axtj)
FACT: Function {name} appears to {purpose} (source: decompilation)
Cross-references:
FACT: {caller} calls {callee} (source: r2 axtj)
HYPOTHESIS UPDATE: {refined theory} (confidence: {new_value})
Supporting: {fact_ids}
Contradicting: {fact_ids}
New questions:
QUESTION: {discovered unknown}
Answered questions:
RESOLVED: {question} → {answer}[BINARY-RE:static] thermostat_daemon (sha256: a1b2c3d4...)
Functions analyzed: 47
Decompilation performed: yes (function 0x8400)
Key functions:
FACT: Function 0x8400 calls curl_easy_perform, curl_easy_setopt (source: r2 axfj)
FACT: Function 0x8400 references string "api.thermco.com/telemetry" (source: r2 axtj)
FACT: Function 0x9200 parses JSON using jsmn library (source: decompilation)
FACT: Function 0x10800 is main loop, calls 0x8400 after sleep(30) (source: r2 pdf)
Cross-references:
FACT: main calls init_config (0x9000) then main_loop (0x10800) (source: r2 axtj)
FACT: main_loop calls send_telemetry (0x8400) in loop (source: r2 pdf)
HYPOTHESIS UPDATE: Telemetry client sending to api.thermco.com every 30 seconds (confidence: 0.85)
Supporting: URL string, curl imports, sleep(30) in loop
Contradicting: none
New questions:
QUESTION: What data fields are included in telemetry payload?
QUESTION: Is there any authentication/API key?
Answered questions:
RESOLVED: "What endpoint?" → api.thermco.com/telemetry via HTTPSAfter static analysis:
→ binary-re-dynamic-analysis to verify hypotheses with runtime observation → binary-re-synthesis if sufficient understanding reached
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 23,507 | 20,813 | -11% | 1 | 1 | 0% | 4,878 | 6,975 | +43% | 0 | 0 | — |
case-02 | fail→fail | 19,897 | 6,702 | -66% | 1 | 1 | 0% | 3,496 | 3,408 | -3% | 0 | 0 | — |
case-03 | fail→pass | 45,142 | 31,309 | -31% | 1 | 1 | 0% | 5,214 | 8,114 | +56% | 0 | 0 | — |
case-04 | pass→pass | 9,535 | 6,454 | -32% | 1 | 1 | 0% | 1,626 | 4,051 | +149% | 0 | 0 | — |
case-05 | pass→pass | 16,514 | 19,120 | +16% | 1 | 1 | 0% | 2,564 | 5,335 | +108% | 0 | 0 | — |
case-06 | pass→pass | 14,108 | 9,412 | -33% | 1 | 1 | 0% | 2,374 | 4,620 | +95% | 0 | 0 | — |
case-07 | pass→pass | 10,696 | 6,326 | -41% | 1 | 1 | 0% | 1,761 | 4,101 | +133% | 0 | 0 | — |
case-08 | fail→pass | 19,282 | 4,152 | -78% | 1 | 1 | 0% | 1,243 | 3,762 | +203% | 0 | 0 | — |
case-09 | fail→pass | 9,754 | 3,441 | -65% | 1 | 1 | 0% | 1,570 | 3,597 | +129% | 0 | 0 | — |
case-10 | fail→pass | 6,216 | 3,889 | -37% | 1 | 1 | 0% | 1,007 | 3,720 | +269% | 0 | 0 | — |
case-11 | pass→pass | 6,821 | 2,746 | -60% | 1 | 1 | 0% | 1,242 | 3,470 | +179% | 0 | 0 | — |
case-12 | pass→pass | 7,700 | 2,038 | -74% | 1 | 1 | 0% | 1,442 | 3,386 | +135% | 0 | 0 | — |
case-13 | pass→pass | 4,678 | 3,889 | -17% | 1 | 1 | 0% | 769 | 3,634 | +373% | 0 | 0 | — |
case-14 | pass→pass | 7,471 | 2,637 | -65% | 1 | 1 | 0% | 1,273 | 3,434 | +170% | 0 | 0 | — |
case-15 | fail→pass | 13,867 | 6,974 | -50% | 1 | 1 | 0% | 2,720 | 4,459 | +64% | 0 | 0 | — |
case-16 | pass→pass | 7,940 | 3,225 | -59% | 1 | 1 | 0% | 1,346 | 3,579 | +166% | 0 | 0 | — |
case-17 | fail→pass | 11,116 | 5,387 | -52% | 1 | 1 | 0% | 1,976 | 3,953 | +100% | 0 | 0 | — |
case-18 | pass→pass | 6,314 | 2,760 | -56% | 1 | 1 | 0% | 1,000 | 3,439 | +244% | 0 | 0 | — |
case-19 | pass→pass | 8,154 | 5,624 | -31% | 1 | 1 | 0% | 1,390 | 3,654 | +163% | 0 | 0 | — |
case-20 | fail→pass | 16,285 | 9,942 | -39% | 1 | 1 | 0% | 2,639 | 5,168 | +96% | 0 | 0 | — |
case-21 | pass→pass | 5,231 | 3,494 | -33% | 1 | 1 | 0% | 856 | 3,545 | +314% | 0 | 0 | — |
case-22 | fail→pass | 5,616 | 2,631 | -53% | 1 | 1 | 0% | 966 | 3,478 | +260% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +41 percentage points is the difference between those two pass rates over the 20 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.