| name | reverse-engineering-deep-analysis |
| description | Advanced binary analysis with runtime execution and symbolic path exploration (RE Levels 3-4). Use when need runtime behavior, memory dumps, secret extraction, or input synthesis to reach specific program states. Completes in 3-7 hours with GDB+Angr. |
| allowed-tools | Read, Glob, Grep, Bash, Task, TodoWrite |
LIBRARY-FIRST PROTOCOL (MANDATORY)
Before writing ANY code, you MUST check:
Step 1: Library Catalog
- Location:
.claude/library/catalog.json
- If match >70%: REUSE or ADAPT
Step 2: Patterns Guide
- Location:
.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md
- If pattern exists: FOLLOW documented approach
Step 3: Existing Projects
- Location:
D:\Projects\*
- If found: EXTRACT and adapt
Decision Matrix
| Match | Action |
|---|
| Library >90% | REUSE directly |
| Library 70-90% | ADAPT minimally |
| Pattern exists | FOLLOW pattern |
| In project | EXTRACT |
| No match | BUILD (add to library after) |
When to Use This Skill
Use this skill when analyzing malware samples, reverse engineering binaries for security research, conducting vulnerability assessments, extracting IOCs from suspicious files, validating software for supply chain security, or performing CTF challenges and binary exploitation research.
When NOT to Use This Skill
Do NOT use for unauthorized reverse engineering of commercial software, analyzing binaries on production systems, reversing software without legal authorization, violating terms of service or EULAs, or analyzing malware outside isolated environments. Avoid for simple string extraction (use basic tools instead).
Success Criteria
- All security-relevant behaviors identified (network, file, registry, process activity)
- Malicious indicators extracted with confidence scores (IOCs, C2 domains, encryption keys)
- Vulnerabilities documented with CVE mapping where applicable
- Analysis completed within sandbox environment (VM/container with snapshots)
- Findings validated through multiple analysis methods (static + dynamic + symbolic)
- Complete IOC report generated (STIX/MISP format for threat intelligence sharing)
- Zero false positives in vulnerability assessments
- Exploitation proof-of-concept created (if vulnerability research)
Edge Cases & Challenges
- Anti-analysis techniques (debugger detection, VM detection, timing checks)
- Obfuscated or packed binaries requiring unpacking
- Multi-stage malware with encrypted payloads
- Kernel-mode rootkits requiring specialized analysis
- Symbolic execution state explosion (>10,000 paths)
- Binary analysis timeout on complex programs (>24 hours)
- False positives from legitimate software behavior
- Encrypted network traffic requiring SSL interception
Guardrails (CRITICAL SECURITY RULES)
- NEVER execute unknown binaries on host systems (ONLY in isolated VM/sandbox)
- NEVER analyze malware without proper containment (air-gapped lab preferred)
- NEVER reverse engineer software without legal authorization
- NEVER share extracted credentials or encryption keys publicly
- NEVER bypass licensing mechanisms for unauthorized use
- ALWAYS use sandboxed environments with network monitoring
- ALWAYS take VM snapshots before executing suspicious binaries
- ALWAYS validate findings through multiple analysis methods
- ALWAYS document analysis methodology with timestamps
- ALWAYS assume binaries are malicious until proven safe
- ALWAYS use network isolation to prevent malware communication
- ALWAYS sanitize IOCs before sharing (redact internal IP addresses)
Evidence-Based Validation
All reverse engineering findings MUST be validated through:
- Multi-method analysis - Static + dynamic + symbolic execution confirm same behavior
- Sandbox validation - Execute in isolated environment, capture all activity
- Network monitoring - Packet capture validates network-based findings
- Memory forensics - Validate runtime secrets through memory dumps
- Behavioral correlation - Cross-reference with known malware signatures (YARA, ClamAV)
- Reproducibility - Second analyst can replicate findings from analysis artifacts
Reverse Engineering: Deep Analysis
What This Skill Does
Performs deep reverse engineering through runtime execution and symbolic exploration:
- Level 3 (≤1 hr): Dynamic analysis - Execute in sandbox with GDB, capture memory/secrets, trace syscalls
- Level 4 (2-6 hrs): Symbolic execution - Use Angr/Z3 to synthesize inputs that reach target states
Decision Gate: After Level 3, evaluates if symbolic execution needed to reach unexplored paths.
Timebox: 3-7 hours total
Prerequisites
Level 3 Tools
- GDB with GEF or Pwndbg extensions
- strace/ltrace - System/library call tracing
- Sandbox environment - Isolated execution (firejail, Docker, or custom)
Level 4 Tools
- Angr - Symbolic execution framework (Python)
- Z3 - SMT solver
- Python 3.9+ - For Angr scripts
MCP Servers
sandbox-validator - Safe binary execution
memory-mcp - Store runtime findings
sequential-thinking - Path exploration decisions
graph-analyst - Visualize execution paths
⚠️ CRITICAL SECURITY WARNING
NEVER execute unknown binaries on your host system!
All dynamic analysis, debugging, and symbolic execution MUST be performed in:
- Isolated VM (VMware/VirtualBox with snapshots for rollback)
- Docker container with security policies (
--security-opt, --cap-drop=ALL)
- E2B sandbox via sandbox-configurator skill with network monitoring
- Dedicated malware analysis lab (air-gapped if handling APTs)
Consequences of unsafe execution:
- Malware infection with kernel-level rootkits
- Memory corruption and system instability
- Data exfiltration via covert channels
- Supply chain attacks via trojanized builds
- Complete system compromise
Safe Practices:
- Always use sandboxed environments with snapshots
- Monitor syscalls and network activity during execution
- Use GDB/Angr in isolated containers only
- Never attach debuggers to binaries on production systems
- Validate all inputs before symbolic execution
- Assume all binaries are malicious until proven safe through static analysis
Quick Start
/re:deep crackme.exe
/re:dynamic server.bin --args "--port 8080"
/re:symbolic challenge.exe --target-addr 0x401337
Level 3: Dynamic Analysis (≤1 hour)
Step 1: Safe Execution in Sandbox
/re:dynamic binary.exe --args "test input" --sandbox true
Sandboxing:
- Filesystem isolation (read-only /usr, /bin)
- Network disabled or monitored
- Process limits (CPU, memory, time)
- Prevents malware escape
Step 2: Retrieve Static Analysis Context
Before executing, the skill automatically retrieves Level 2 findings:
const staticFindings = await mcp__memory-mcp__vector_search({
query: binary_hash,
filter: {category: "reverse-engineering", re_level: 2}
})
const breakpoints = staticFindings.critical_functions.map(f => f.address)
Step 3: GDB Session with Auto-Loaded Breakpoints
Automatically loads breakpoints from Level 2 static analysis:
# Auto-generated from static analysis
break *0x401234 # check_password function
break *0x401567 # validate_license function
break *0x4018ab # decrypt_config function
# Run with test input
run --flag "test_input_from_user"
GDB Session Commands (executed automatically):
# At each breakpoint:
# 1. Dump all registers
info registers
# 2. Dump stack (100 bytes)
x/100x $rsp
# 3. Dump heap allocations (if applicable)
info proc mappings
x/100x [heap_address]
# 4. Search for secrets in memory
find 0x600000, 0x700000, "password"
find 0x600000, 0x700000, "admin"
# 5. Dump interesting strings from registers
x/s $rdi # First argument (often string pointer)
x/s $rsi # Second argument
Step 4: Capture Runtime State
At each breakpoint, the skill captures:
Register State:
RAX: 0x0000000000401337
RBX: 0x0000000000000000
RCX: 0x00007fffffffe010 → "user_input_here"
RDX: 0x0000000000000010
RSI: 0x00007fffffffe020 → "expected_password"
RDI: 0x00007fffffffe030 → buffer
RBP: 0x00007fffffffe100
RSP: 0x00007fffffffe0e0
RIP: 0x0000000000401234 → check_password
Stack Dump (saved to re-project/dbg/0x401234-stack.bin):
0x7fffffffe0e0: 0x0000000000401337 0x0000000000000000
0x7fffffffe0f0: 0x00007fffffffe200 0x0000000000000001
Memory Secrets (extracted automatically):
Found at 0x601000: "admin:SecretP@ss123"
Found at 0x601020: "license_key=ABC-DEF-GHI-JKL"
Found at 0x601040: "api_token=eyJhbGciOiJIUzI1NiIs..."
Syscall Trace (via strace):
strace -o re-project/dbg/syscalls.log ./binary.exe --flag test
Output:
open("/etc/config.ini", O_RDONLY) = 3
read(3, "password=admin123\n", 1024) = 18
socket(AF_INET, SOCK_STREAM, 0) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("192.168.1.100")}, 16) = 0
send(4, "POST /api/login HTTP/1.1\r\n...", 256, 0) = 256
Step 5: Output Structure
re-project/dbg/
├── gdb-session.log # Full GDB transcript
├── breakpoints.txt # List of breakpoints set
├── memory-dumps/
│ ├── 0x401234-registers.txt
│ ├── 0x401234-stack.bin
│ ├── 0x401567-registers.txt
│ ├── 0x401567-stack.bin
│ └── 0x4018ab-heap.bin
├── syscalls.log # strace output
├── libcalls.log # ltrace output
└── runtime-secrets.txt # Extracted passwords, keys, tokens
Step 6: Decision Gate - Escalate to Level 4?
const decision = await mcp__sequential-thinking__evaluate({
question: "Should we proceed to symbolic execution (Level 4)?",
factors: [
`Branches explored: ${explored_branches}/${total_branches}`,
`Unreachable code found: ${unreachable_functions.length > 0}`,
`User's question answered: ${findings_sufficient}`,
`Input-dependent paths: ${symbolic_paths_needed}`
]
})
Level 4: Symbolic Execution (2-6 hours)
Step 1: Define Target State from Dynamic Analysis
target_addr = 0x401337
avoid_addrs = [
0x401400,
0x401500,
0x401600
]
Step 2: Launch Symbolic Exploration
/re:symbolic binary.exe \
--target-addr 0x401337 \
--avoid-addrs 0x401400,0x401500,0x401600 \
--max-states 1000 \
--timeout 7200
What Happens Under the Hood:
import angr
import claripy
project = angr.Project('./binary.exe', auto_load_libs=False)
flag_length = 32
flag = claripy.BVS('flag', flag_length * 8)
state = project.factory.entry_state(
stdin=flag,
add_options={angr.options.LAZY_SOLVES}
)
for byte in flag.chop(8):
state.add_constraints(byte >= 0x20)
state.add_constraints(byte <= 0x7e)
simgr = project.factory.simulation_manager(state)
simgr.explore(
find=0x401337,
avoid=[0x401400, 0x401500, 0x401600],
num_find=1,
max_states=1000
)
if simgr.found:
solution_state = simgr.found[0]
solution = solution_state.solver.eval(flag, cast_to=bytes)
print(f"Solution: {solution.decode()}")
with open('re-project/sym/solutions/solution-1.txt', 'wb') as f:
f.write(solution)
else:
print("No solution found within constraints")
Step 3: Advanced Symbolic Techniques
Technique 1: Hook Library Functions
import angr
class StrCmpHook(angr.SimProcedure):
def run(self, s1, s2):
s1_str = self.state.memory.load(s1, 32)
s2_str = self.state.memory.load(s2, 32)
return s1_str == s2_str
project.hook_symbol('strcmp', StrCmpHook())
Technique 2: State Merging for Complex Paths
simgr.use_technique(angr.exploration_techniques.Veritesting())
while simgr.active:
simgr.step()
if len(simgr.active) > 50:
simgr.merge()
Technique 3: Constraint Simplification
state.add_constraints(
flag[0:4] == b'FLAG'
)
Step 4: Validate Solution
echo "FLAG_synthesized_solution_here" | ./binary.exe
Validation Steps:
- Run binary with synthesized input
- Verify execution reaches target address (0x401337)
- Check output matches expected success message
- Store validated solution in memory-mcp
Step 5: Output Structure
re-project/sym/
├── angr-script.py # Reproducible Angr script
├── solutions/
│ ├── solution-1.txt # First valid solution
│ ├── solution-2.txt # Alternative solution (if --find-all)
│ └── solution-3.txt
├── constraints/
│ ├── path-1.smt2 # Z3 constraints for path 1
│ ├── path-2.smt2
│ └── simplified.smt2 # Simplified constraint set
├── validation.log # Validation test results
└── exploration-metrics.json # States explored, time taken, coverage
exploration-metrics.json:
{
"total_states": 847,
"found_states": 3,
"avoided_states": 124,
"deadended_states": 720,
"execution_time_sec": 3245,
"coverage_percent": 78.5,
"memory_usage_mb": 2847,
"solutions_found": 3
}
Advanced Options
Custom Breakpoints (Dynamic Analysis)
/re:dynamic binary.exe --breakpoints AES_encrypt,RSA_sign,MD5_update
/re:dynamic binary.exe --breakpoints 0x401000,0x402000,0x403000
/re:dynamic binary.exe --breakpoints "0x401234 if $rdi == 0x601000"
Advanced GDB Scripting:
import gdb
class PasswordBreakpoint(gdb.Breakpoint):
def __init__(self, location):
super().__init__(location)
def stop(self):
rdi = gdb.parse_and_eval('$rdi')
password = gdb.execute(f'x/s {rdi}', to_string=True)
with open('passwords.log', 'a') as f:
f.write(f"{password}\n")
return False
PasswordBreakpoint("check_password")
Symbolic Exploration Strategies
Strategy 1: Find ALL Solutions
/re:symbolic binary.exe \
--target-addr 0x401337 \
--find-all true \
--max-solutions 10 \
--timeout 14400
simgr.explore(
find=0x401337,
avoid=avoid_addrs,
num_find=10
)
for idx, state in enumerate(simgr.found):
solution = state.solver.eval(flag, cast_to=bytes)
with open(f'solution-{idx+1}.txt', 'wb') as f:
f.write(solution)
Strategy 2: Limit State Explosion
/re:symbolic binary.exe \
--max-states 100 \
--avoid-addrs 0x401400,0x401500,0x401600 \
--strategy dfs
simgr.use_technique(angr.exploration_techniques.Veritesting())
simgr.use_technique(angr.exploration_techniques.LengthLimiter(max_length=100))
simgr.use_technique(angr.exploration_techniques.Explorer(
find=0x401337,
avoid=avoid_addrs,
num_find=1
))
Strategy 3: Under-Constrained Symbolic Execution
project = angr.Project('./binary.exe')
state = project.factory.blank_state(addr=0x401337)
state.options.add(angr.options.SYMBION_SYNC_CLE)
simgr = project.factory.simulation_manager(state)
simgr.explore(find=project.entry)
Memory Dump Analysis
/re:dynamic binary.exe \
--dump-regions heap,stack,data \
--dump-at-breakpoints 0x401234,0x401567
Custom Memory Analysis:
import gdb
def analyze_heap():
mappings = gdb.execute('info proc mappings', to_string=True)
heap_start = extract_heap_start(mappings)
heap_end = extract_heap_end(mappings)
for addr in range(heap_start, heap_end, 8):
value = gdb.execute(f'x/g {addr}', to_string=True)
if is_valid_pointer(value):
gdb.execute(f'x/s {value}')
analyze_heap()
Comprehensive Workflow Examples
Workflow 1: Malware Analysis with Runtime Secrets
Scenario: Analyze malware sample to extract C2 server URL and encryption keys
Phase 1: Dynamic Analysis (Level 3)
/re:dynamic malware.exe --sandbox true --network-monitor true
(gdb) info registers
RAX: 0x0000000000601000 → encrypted_buffer
RDI: 0x0000000000601100 → decryption_key
(gdb) x/s 0x601100
0x601100: "hardcoded_AES_key_12345"
(gdb) continue
(gdb) x/s $rdi
0x601200: "http://malicious-c2.tk:8443/beacon"
Runtime Secrets Found:
- AES Key: "hardcoded_AES_key_12345"
- C2 URL: "http://malicious-c2.tk:8443/beacon"
- User-Agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
Phase 2: Decision Gate
QUESTION: "Proceed to symbolic execution?"
FACTORS:
- All critical functions reached ✅
- Secrets extracted (AES key, C2 URL) ✅
- User's question answered (extract IOCs) ✅
- No unreachable paths requiring symbolic execution ❌
DECISION: STOP AT LEVEL 3 (sufficient findings)
Output: Malware analysis complete in 45 minutes with full IOC extraction.
Workflow 2: CTF Challenge - Reversing License Check
Scenario: Find valid license key to unlock "premium features" in binary
Phase 1: Dynamic Analysis (Level 3)
/re:dynamic challenge.exe --args "--license AAAA-BBBB-CCCC-DDDD"
(gdb) break *0x401234
(gdb) run --license AAAA-BBBB-CCCC-DDDD
(gdb) x/s $rdi
0x7fffffffe010: "AAAA-BBBB-CCCC-DDDD"
(gdb) x/s $rsi
0x601000: [encrypted data, not readable]
Phase 2: Decision Gate
QUESTION: "Proceed to symbolic execution?"
FACTORS:
- License check function found ✅
- Valid key NOT extractable from memory ✅
- Comparison is complex (encryption/hashing) ✅
- User wants valid license key ✅
DECISION: ESCALATE TO LEVEL 4 (symbolic execution required)
Phase 3: Symbolic Execution (Level 4)
/re:symbolic challenge.exe \
--target-addr 0x401337 \
--avoid-addrs 0x401400 \
--input-format "FLAG-XXXX-XXXX-XXXX" \
--max-states 500
Angr Script (auto-generated):
import angr
import claripy
project = angr.Project('./challenge.exe', auto_load_libs=False)
license_key = claripy.BVS('license', 19 * 8)
state = project.factory.entry_state(args=['./challenge.exe', '--license', license_key])
for i in range(19):
if i in [0, 1, 2, 3]:
state.add_constraints(license_key.get_byte(i) == ord("FLAG"[i]))
elif i in [4, 9, 14]:
state.add_constraints(license_key.get_byte(i) == ord('-'))
else:
byte = license_key.get_byte(i)
state.add_constraints(
claripy.Or(
claripy.And(byte >= ord('A'), byte <= ord('Z')),
claripy.And(byte >= ord('0'), byte <= ord('9'))
)
)
simgr = project.factory.simulation_manager(state)
simgr.explore(find=0x401337, avoid=0x401400)
if simgr.found:
solution = simgr.found[0].solver.eval(license_key, cast_to=bytes)
print(f"Valid License: {solution.decode()}")
Validation:
$ ./challenge.exe --license FLAG-A7B2-C9D4-E1F6
Premium features unlocked!
Congratulations! Here is your flag: CTF{symbolic_execution_wins}
Output: Challenge solved in 3.5 hours total (45min dynamic + 3hr symbolic).
Workflow 3: Vulnerability Research - Buffer Overflow
Scenario: Find exploitable buffer overflow in server binary
Phase 1: Dynamic Analysis (Level 3)
/re:dynamic server.bin --args "--port 8080" --sandbox true
echo "A"*1000 | nc localhost 8080
Program received signal SIGSEGV, Segmentation fault.
0x4141414141414141 in ?? ()
(gdb) info registers
RIP: 0x4141414141414141
RSP: 0x7fffffffe100
RBP: 0x4141414141414141
(gdb) x/100x $rsp
(gdb) pattern create 1000
(gdb) run
Phase 2: Decision Gate
QUESTION: "Proceed to symbolic execution?"
FACTORS:
- Buffer overflow confirmed ✅
- Offset to RIP known (512 bytes) ✅
- Exploitation demonstrated ✅
- User's goal: find vulnerability ✅ (COMPLETE)
DECISION: STOP AT LEVEL 3 (vulnerability found)
Output: Vulnerability research complete in 30 minutes.
Troubleshooting
Issue 1: Sandbox Blocks Execution
Symptoms: Binary fails to run with "Permission denied" or syscall blocked errors
Cause: Sandbox too restrictive, blocking necessary syscalls
Solution 1: Whitelist necessary syscalls
strace ./binary.exe 2>&1 | grep "Operation not permitted"
cat > sandbox-profile.json <<EOF
{
"defaultAction": "SCMP_ACT_ERRNO",
"syscalls": [
{"names": ["read", "write", "open", "close"], "action": "SCMP_ACT_ALLOW"},
{"names": ["socket", "connect"], "action": "SCMP_ACT_ALLOW"}
]
}
EOF
/re:dynamic binary.exe --sandbox-profile sandbox-profile.json
Solution 2: Use less restrictive sandbox
/re:dynamic server.bin --sandbox true --allow-network true
docker run --rm -v $(pwd):/work -it ubuntu:20.04 /work/binary.exe
Issue 2: GDB Fails to Attach
Symptoms: "ptrace: Operation not permitted" or GDB won't start
Cause: System security settings prevent ptrace
Solution 1: Temporarily allow ptrace (Linux)
cat /proc/sys/kernel/yama/ptrace_scope
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
/re:dynamic binary.exe
Solution 2: Run GDB with sudo
sudo /re:dynamic binary.exe
Solution 3: Use container (bypass host restrictions)
docker run --cap-add=SYS_PTRACE --rm -it ubuntu:20.04 bash
apt update && apt install gdb
gdb ./binary.exe
Issue 3: Angr State Explosion
Symptoms: Symbolic execution runs out of memory or times out with thousands of active states
Cause: Binary has too many branches, creating exponential state explosion
Solution 1: Add more avoid states
/re:static binary.exe --list-functions | grep -i "fail\|error\|exit"
/re:symbolic binary.exe \
--target-addr 0x401337 \
--avoid-addrs 0x401400,0x401500,0x401600,0x401700,0x401800 \
--max-states 100
Solution 2: Use Veritesting (merge states automatically)
simgr.use_technique(angr.exploration_techniques.Veritesting())
Solution 3: Start from intermediate address (skip unimportant code)
state = project.factory.blank_state(addr=0x401234)
state.regs.rdi = state.solver.BVS('input', 32*8)
simgr = project.factory.simulation_manager(state)
simgr.explore(find=0x401337)
Issue 4: Memory Dumps Too Large
Symptoms: GDB dumps gigabytes of memory, fills disk space
Cause: Dumping entire address space instead of targeted regions
Solution 1: Target specific memory regions from vmmap
# Check memory mappings
(gdb) info proc mappings
# Example output:
# 0x400000-0x600000 r-xp /path/binary.exe (code)
# 0x600000-0x700000 rw-p /path/binary.exe (data)
# 0x7ffff7a0d000-0x7ffff7bcd000 r-xp /lib/libc.so (library)
# Dump ONLY data section (where secrets likely are)
(gdb) dump binary memory data-section.bin 0x600000 0x700000
# Dump ONLY stack (where local variables are)
(gdb) dump binary memory stack.bin $rsp-0x1000 $rsp+0x1000
Solution 2: Use selective breakpoint dumps
/re:dynamic binary.exe \
--breakpoints 0x401234,0x401567 \
--dump-at-breakpoints true \
--dump-regions stack,heap
Issue 5: Symbolic Execution Timeout
Symptoms: Angr runs for hours without finding solution
Cause: Constraint solver (Z3) stuck on complex constraints
Solution 1: Increase timeout and simplify constraints
/re:symbolic binary.exe \
--timeout 14400 \
--max-states 200 \
--simplify-constraints true
Solution 2: Use incremental solving
state.solver.add(constraint1)
if state.satisfiable():
state.solver.add(constraint2)
if state.satisfiable():
state.solver.add(constraint3)
Solution 3: Use faster solver (CVC4 or Boolector)
import angr
import claripy
claripy.backends.backend_manager.backends._eager_backends = [
claripy.backends.BackendConcrete,
claripy.backends.BackendZ3
]
Performance Optimization
Speed Up Dynamic Analysis (Level 3)
Optimization 1: Parallel Syscall Tracing
(strace -o syscalls.log ./binary.exe &)
(ltrace -o libcalls.log ./binary.exe &)
wait
Optimization 2: GDB Scripting for Automation
import gdb
breakpoints = [0x401234, 0x401567, 0x4018ab]
for bp_addr in breakpoints:
gdb.Breakpoint(f"*{bp_addr}")
gdb.execute('run')
for i in range(len(breakpoints)):
regs = gdb.execute('info registers', to_string=True)
stack = gdb.execute('x/100x $rsp', to_string=True)
with open(f'bp-{i}-state.txt', 'w') as f:
f.write(f"Registers:\n{regs}\nStack:\n{stack}\n")
if i < len(breakpoints) - 1:
gdb.execute('continue')
Usage:
gdb -x auto-analyze.py ./binary.exe
Optimization 3: Selective Memory Dumping
/re:dynamic binary.exe \
--dump-on-pattern "password|secret|key|token" \
--dump-regions heap
Speed Up Symbolic Execution (Level 4)
Optimization 1: Use Faster Exploration Strategy
simgr.use_technique(angr.exploration_techniques.DFS())
simgr.use_technique(angr.exploration_techniques.BFS())
simgr.use_technique(angr.exploration_techniques.Explorer(
find=0x401337,
num_find=1
))
Optimization 2: Pre-Constrain Input Space
for i, char in enumerate("FLAG"):
state.add_constraints(flag.get_byte(i) == ord(char))
Optimization 3: Hook Complex Functions
project.hook_symbol('strlen', angr.SIM_PROCEDURES['libc']['strlen']())
project.hook_symbol('strcmp', angr.SIM_PROCEDURES['libc']['strcmp']())
project.hook_symbol('memcpy', angr.SIM_PROCEDURES['libc']['memcpy']())
Optimization 4: Parallelize Exploration
from multiprocessing import Pool
def explore_from_state(state):
simgr = project.factory.simulation_manager(state)
simgr.explore(find=0x401337, avoid=avoid_addrs)
return simgr.found
states = [state.copy() for _ in range(4)]
states[0].add_constraints(flag[0] < 0x40)
states[1].add_constraints(claripy.And(flag[0] >= 0x40, flag[0] < 0x60))
states[2].add_constraints(claripy.And(flag[0] >= 0x60, flag[0] < 0x80))
states[3].add_constraints(flag[0] >= 0x80)
with Pool(4) as p:
results = p.map(explore_from_state, states)
for found_states in results:
if found_states:
print(found_states[0].solver.eval(flag, cast_to=bytes))
Memory-MCP Integration
Storing Level 3 Findings
mcp__memory-mcp__memory_store({
content: {
binary_hash: "sha256:abc123...",
re_level: 3,
execution_summary: {
breakpoints_hit: ["0x401234", "0x401567", "0x4018ab"],
runtime_secrets: [
{type: "password", value: "admin123", location: "0x601000"},
{type: "api_key", value: "sk_live_...", location: "0x601020"}
],
syscalls: ["open", "read", "socket", "connect", "send"],
network_activity: [
{proto: "HTTP", dest: "192.168.1.100:443", data: "POST /api/login"}
]
},
gdb_dumps: {
registers: "re-project/dbg/memory-dumps/",
stack: "re-project/dbg/memory-dumps/",
heap: "re-project/dbg/memory-dumps/"
}
},
metadata: {
agent: "RE-Runtime-Tracer",
category: "reverse-engineering",
intent: "dynamic-analysis",
layer: "long_term",
project: `binary-analysis-${date}`,
keywords: ["gdb", "dynamic", "runtime", "secrets"],
re_level: 3,
binary_hash: "sha256:abc123...",
timestamp: new Date().toISOString()
}
})
Storing Level 4 Findings
mcp__memory-mcp__memory_store({
content: {
binary_hash: "sha256:abc123...",
re_level: 4,
symbolic_summary: {
target_address: "0x401337",
avoid_addresses: ["0x401400", "0x401500"],
solutions_found: 3,
solutions: [
{input: "FLAG-A7B2-C9D4-E1F6", validated: true},
{input: "FLAG-B8C3-D0E5-F2G7", validated: true},
{input: "FLAG-C9D4-E1F6-G3H8", validated: true}
],
exploration_metrics: {
total_states: 847,
execution_time_sec: 3245,
coverage_percent: 78.5
}
},
angr_script: "re-project/sym/angr-script.py",
constraints: "re-project/sym/constraints/"
},
metadata: {
agent: "RE-Symbolic-Solver",
category: "reverse-engineering",
intent: "symbolic-execution",
layer: "long_term",
project: `binary-analysis-${date}`,
keywords: ["angr", "symbolic", "z3", "solver"],
re_level: 4,
binary_hash: "sha256:abc123...",
timestamp: new Date().toISOString()
}
})
Handoff Pattern: Level 3 → Level 4
mcp__memory-mcp__memory_store({
key: `re-handoff/dynamic-to-symbolic/${binary_hash}`,
value: {
decision: "ESCALATE_TO_LEVEL_4",
reason: "Target function unreachable with manual inputs",
target_address: "0x401337",
avoid_addresses: ["0x401400", "0x401500", "0x401600"],
input_format: "FLAG-XXXX-XXXX-XXXX",
breakpoint_findings: {
"0x401234": {
description: "License check function",
comparison_type: "encrypted",
extractable: false
}
}
}
})
const handoff = await mcp__memory-mcp__vector_search({
query: `re-handoff/dynamic-to-symbolic/${binary_hash}`
})
const target = handoff.target_address
const avoid = handoff.avoid_addresses
const input_format = handoff.input_format
Agents & Commands
Agents Invoked
-
RE-Runtime-Tracer (Level 3)
- Specialist: Dynamic analysis with GDB/strace/ltrace
- Tools: GDB+GEF/Pwndbg, strace, ltrace, sandbox environments
- Output: Memory dumps, syscall traces, runtime secrets
-
RE-Symbolic-Solver (Level 4)
- Specialist: Symbolic execution with Angr/Z3
- Tools: Angr, Z3, Python symbolic execution frameworks
- Output: Synthesized inputs, constraint files, validated solutions
-
sandbox-validator (Level 3, automatic)
- Provides safe binary execution environment
- Prevents malware escape and system damage
-
graph-analyst (Level 4, automatic)
- Generates execution path visualizations
- Creates constraint dependency graphs
Slash Commands
/re:deep <binary> - Full Level 3+4 analysis (this skill's primary command)
/re:dynamic <binary> - Level 3 only (dynamic analysis)
/re:symbolic <binary> - Level 4 only (symbolic execution)
MCP Servers
- sandbox-validator: Safe binary execution with isolation
- memory-mcp: Cross-session persistence, handoff coordination
- sequential-thinking: Decision gate logic for escalation
- graph-analyst: Visualization of execution paths and constraints
Related Skills
Resources
External Tools
- GDB - GNU Debugger
- GEF - GDB Enhanced Features
- Pwndbg - GDB plugin for exploit development
- Angr - Binary analysis platform
- Z3 - Microsoft SMT solver
Learning Resources
Community
Created: 2025-11-01
RE Levels: 3-4 (Dynamic Analysis + Symbolic Execution)
Timebox: 3-7 hours
Agents: RE-Runtime-Tracer, RE-Symbolic-Solver
Category: Security, Malware Analysis, CTF, Binary Exploitation
Difficulty: Advanced
Core Principles
Reverse Engineering: Deep Analysis operates on 3 fundamental principles:
Principle 1: Isolation-First Execution
Runtime analysis MUST occur in isolated environments to prevent malware escape and system compromise.
In practice:
- Execute all binaries in snapshots VMs/containers with network monitoring
- Use sandboxed debuggers (GDB in Docker, QEMU with snapshot mode)
- Monitor syscalls, network traffic, and file operations during execution
- Maintain air-gapped lab infrastructure for APT analysis
Principle 2: Multi-Method Validation
No single analysis technique provides complete truth - cross-validation prevents false positives.
In practice:
- Static analysis findings must be confirmed by dynamic execution
- Dynamic behavior must be reproducible across multiple runs
- Symbolic execution results must validate against real execution paths
- Memory dumps must correlate with network captures and syscall traces
Principle 3: Progressive Escalation
Start with lightweight methods, escalate only when necessary to minimize analysis time.
In practice:
- Level 3 (dynamic) reveals 80% of malware behavior in under 1 hour
- Escalate to Level 4 (symbolic) only when paths are unreachable manually
- Use decision gates to avoid over-engineering simple analysis tasks
- Cache findings in memory-mcp to prevent duplicate work
Common Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|
| Executing malware on host system | Complete system compromise, data exfiltration, ransomware deployment | ALWAYS use isolated VM with snapshots, network monitoring, and rollback capability |
| Skipping static analysis before dynamic | Waste time executing without understanding, miss packed binaries | Run Level 1-2 (strings + static) first to identify entry points and breakpoints |
| Over-relying on symbolic execution | State explosion, analysis timeout, resource exhaustion | Use symbolic execution only for input-dependent paths unreachable by manual fuzzing |
| Ignoring anti-analysis techniques | Debugger detection terminates analysis, VM detection changes behavior | Patch anti-debug checks, use stealthy debugging environments, monitor timing attacks |
| Not documenting methodology | Results not reproducible, findings challenged, legal issues | Timestamp all actions, save GDB transcripts, document tool versions and commands used |
Conclusion
Reverse Engineering: Deep Analysis represents the critical bridge between static code inspection and complete program comprehension. By combining runtime execution (Level 3) with symbolic path exploration (Level 4), this skill enables security researchers to extract secrets, validate vulnerabilities, and synthesize inputs that reach specific program states - capabilities essential for malware analysis, CTF challenges, and vulnerability research.
The skill's power lies in its automated decision gates and progressive escalation strategy. Rather than immediately jumping to resource-intensive symbolic execution, the skill starts with lightweight dynamic analysis using GDB and system call tracing. Only when manual execution fails to reach target states does it escalate to Angr-based symbolic execution, minimizing analysis time while maximizing findings.
Use this skill when you need to understand runtime behavior that static analysis cannot reveal: memory secrets, network communication patterns, or valid inputs for complex authentication schemes. The skill excels at extracting indicators of compromise from malware, finding valid license keys in crackmes, and generating proof-of-concept exploits for vulnerabilities. Combined with memory-mcp integration for cross-session persistence and handoff coordination with firmware analysis (Level 5), it forms a comprehensive reverse engineering workflow suitable for both academic research and production security operations.