Reverse Engineering Technique
Extract actionable intelligence efficiently by adapting workflow to your objective.
When to activate
- Malware analysis: Understand behavior, C2, persistence, evasion.
- Software protection analysis: Identify license/protection logic, emulate validation checks, reconstruct key material where authorized.
- Patch diffing: Find security fixes, understand vendor patches.
- Firmware reversing: Extract filesystems, analyze embedded code.
- .NET reversing: Deobfuscate, understand managed code logic.
- Protocol reversing: Reconstruct proprietary protocols or file formats.
- Vulnerability hunting: Find bugs in closed-source components.
- Exploitability triage: Qualify a corruption primitive found during RE, then hand off to
binary-exploitation-technique for chaining and proof.
- Secrets extraction: Recover keys, tokens, passwords.
- Custom VM / obfuscation: Binary has a bytecode VM, LLVM CFF dispatcher, or VMProtect/Themida packing.
- Anti-analysis bypass: Binary exits under debugger, detects VM, crashes analysis tools, or uses signal-handler tricks.
- Side-channel RE: Validation timing, instruction count, or signal behavior leaks per-character correctness.
- Language-specific RE: Go, Rust, Python bytecode, Unity IL2CPP, Nim, VBS/WSH, Node.js/V8 snapshots requires language-specific tooling (see
references/languages.md, references/nim-rev.md, references/node-v8-snapshots.md).
- In-memory loading: Linux binary loads a second-stage ELF via
memfd_create + dlopen (fileless; see references/in-memory-loading.md).
Initial triage
Before diving deep, classify the artifact and the operator objective so the workflow starts in the right lane.
- Starting state: is the target malware, protected software, firmware, a managed assembly, a protocol artifact, a crash primitive, or an unknown binary?
- First questions: what do you need to learn first, what architecture/runtime/packing signals are present, and is static or dynamic evidence the fastest way to reduce uncertainty?
- Immediate actions: perform fast format/entropy/import/string triage, assign the objective workflow, and only then choose the decompiler/debugger/tooling mix.
- Tool-family direction: start with CLI/static triage families (
radare2, objdump, readelf, strings, capa, binwalk) and escalate to heavy decompilation/debugging (ghidra, binaryninja, gdb, x64dbg, windbg, dnspy, frida) once the goal is defined.
- Escalation rule: objective first, tool second; do not decompile everything before deciding what question you are answering.
Core methodology
1. Triage (5-10 min): Quick assessment before deep dive.
2. Define objective: What do you need to know?
3. Select tools: Based on binary type, objective, environment.
4. Static analysis: Structure understanding without execution.
5. Dynamic analysis: Validate assumptions via runtime behavior.
6. Synthesis: Pseudocode, documentation, or exploit.
7. Verification: Test findings; iterate if needed.
Triage (first 5-10 minutes)
Quick assessment to decide approach:
| Check |
Tool reference |
What to look for |
| File type |
file, detect-it-easy |
PE/ELF/Mach-O/.NET, arch, bits |
| Packers/obfuscation |
Detect It Easy, binwalk |
UPX, ASPack, ConfuserEx, high entropy |
| Strings |
strings, radare2 (iz) |
URLs, IPs, registry keys, crypto constants |
| Imports/exports |
radare2 (ii, ie), ghidra |
Suspicious APIs, crypto, network, process |
| Metadata |
pefile, radare2 (iI) |
Timestamps, version, compiler, PDB |
| Hashes |
sha256sum, rahash2 |
Submit to VirusTotal, MalwareBazaar |
| Capabilities |
capa (offensive-tools/forensic/capa/) |
TTP fingerprint, malware family, embedded shellcode |
Decision tree:
- High entropy + suspicious imports → Malware analysis workflow
- Protection messages (registration, trial, activation) → Software protection workflow
- Two versions of same binary → Patch diffing workflow
- Firmware header (uImage, vmlinux) → Firmware workflow
- .NET assembly → .NET reversing workflow
- Network capture + unknown protocol → Protocol RE workflow
- Large
switch(opcode) + byte-buffer IP loop → Custom VM workflow (see references/custom-vm.md)
fork() + ptrace(TRACEME) or SIGTRAP/SIGFPE signal loop → Nanomites (see references/custom-vm.md §2)
- Binary exits/behaves differently under debugger or in VM → Anti-analysis bypass (see
references/anti-analysis.md)
- Validation response varies by character (timing/count) → Side-channel RE (see
references/custom-vm.md §4)
- Go buildid / Rust
__rust_panic / .pyc file → Language-specific RE (see references/languages.md)
- LLVM control flow flattening (dispatcher switch, state variable) →
references/custom-vm.md §6
- VMProtect / Themida packing detected → dump after OEP (see
references/anti-analysis.md §unpacking)
NimMain / HEXnn mangled names / @[ slice constants → Nim RE (see references/nim-rev.md)
pkg/prelude / NODE_SEA_FUSE / snapshot_blob in strings → Node.js/V8 snapshot (see references/node-v8-snapshots.md)
memfd_create in strace / /proc/self/fd/ path to dlopen → In-memory loading (see references/in-memory-loading.md)
ljmp 0x33: / push 0x33; retf in 32-bit ELF → Heaven's Gate Linux (see references/anti-analysis.md §Category 8)
- PCAP / protobuf / gRPC / grpc-web / WebSocket frames / length-prefixed binary RPC → Protocol reversing (see
references/protocol-rev.md)
.crx / .xpi / manifest.json / MV3 service worker / content_scripts / externally_connectable → Browser extension reversing (see references/browser-extension-rev.md)
- Two binary versions for patch analysis / a single Microsoft Patch-Tuesday MSU to reconstruct / stripped library with unknown symbols → Binary diffing / FLIRT (see
references/binary-diffing.md)
- Confirmed overwrite primitive with partial control over RIP/EIP/PC, heap metadata, or function pointer → Exploitability triage (§7b), then hand off to
offensive-techniques/binary-exploitation-technique
- Kernel driver/module, hidden artifacts, boot-chain tampering, or EFI/bootloader changes → Rootkit / bootkit RE workflow (see
references/rootkit-and-bootkit-re.md)
CLI-first tool preference
Prefer CLI/scriptable tooling for triage, batch work, and repeatable evidence. Move to GUI decompilers/debuggers when semantics, types, or interaction speed justify it.
| Need |
Prefer first |
GUI/decompiler escalation |
| File metadata, imports, sections, strings |
rabin2, radare2, objdump, readelf, strings |
Ghidra/Binary Ninja project when structure matters |
| Fast static triage |
radare2 (aaa, afl, iz, ii, iS), capa |
Ghidra for decompilation and type recovery |
| Linux dynamic behavior |
strace, ltrace, gdb |
Ghidra debugger only if needed |
| Windows crash/debug |
windbg/cdb for dump triage |
x64dbg for interactive patch/trace |
| Firmware extraction |
binwalk CLI first |
Ghidra/radare2 per extracted binary |
| .NET |
de4dot/CLI metadata first |
dnspy for decompile/debug/patch |
Formal tool skills: offensive-tools/rev/radare2/, offensive-tools/rev/gdb/, offensive-tools/rev/frida/, offensive-tools/rev/binwalk/, offensive-tools/rev/ghidra/, offensive-tools/rev/binaryninja/, offensive-tools/rev/dnspy/, offensive-tools/rev/windbg/, offensive-tools/rev/x64dbg/, plus offensive-tools/forensic/capa/ for capability triage.
Objective-driven workflows
1. Malware analysis
Goal: Understand behavior, extract IOCs, identify C2, assess threat.
Operator flow:
1. Triage: strings, imports, VirusTotal, Any.Run sandbox report.
2. Static: Load in `ghidra` or `radare2` → auto-analysis.
- Check imports for: VirtualAlloc, CreateRemoteThread, WriteProcessMemory.
- Cross-reference suspicious strings (URLs, IPs, registry paths).
- Identify decryption routines (loops with XOR/RC4/AES).
3. Dynamic: Debug in `x64dbg` (Windows) or `gdb`+`pwndbg` (Linux).
- Set breakpoints on crypto APIs, network APIs.
- Dump decrypted strings/config from memory.
- Monitor: Process Monitor, Wireshark, ProcMon.
- Linux: use `strace -e trace=network,file` to log syscalls without a debugger; `ltrace` for library call interception.
4. Unpack if packed: Use `x64dbg` + Scylla, or `binwalk` for firmware.
5. Report: IOCs, TTPs, C2 config, YARA rules.
Key tricks:
- Decryption routines often precede string usage—trace backwards from strings.
- Config often in resources or appended to binary—check
binwalk, radare2 (iS).
- Anti-debug: PEB.BeingDebugged, NtGlobalFlag, RDTSC—use
ScyllaHide or patch.
- C2 often encrypted with simple XOR—search for XOR loops with constant key.
Key tools: capa (TTP triage), ghidra/radare2 (static), x64dbg/gdb+pwndbg (dynamic), frida (hooking), binwalk (unpacking), strace/ltrace (Linux syscall/lib tracing), windbg (crash dumps).
→ Full workflow: references/re-workflow.md. Anti-debug bypass: references/anti-analysis.md.
2. Software protection bypass and licensing emulation
Goal: Understand license/protection checks, emulate validation, and produce authorized proof of bypass or key-generation logic.
Operator flow:
1. Triage: Identify protection (ASProtect, Themida, custom).
2. Static: Load in `ghidra` → find protection strings, error messages.
- Search for: "Invalid key", "Trial expired", "Wrong password".
- Cross-reference strings to validation functions.
3. Dynamic: Debug in `x64dbg` or `radare2` debugger.
- Set breakpoint on validation function or message box.
- Trace backwards to find comparison logic.
- Patch: NOP conditional jump, or change return value.
4. Key reconstruction: Understand algorithm from decompiled code.
- Reconstruct in Python/C based on pseudocode.
5. Verify: Patched binary accepts valid key.
Key tricks: Cross-ref error strings to validation functions; NOP/invert the final comparison; watch for CRC re-checks after patching.
Key tools: ghidra (decompile validation), x64dbg (patch jumps), frida (hook online activation), dnspy (.NET).
→ Unpacking details: references/anti-analysis.md §unpacking. Binary diffing: references/binary-diffing.md.
3. Patch diffing
Goal: Find what changed between two binary versions (security patch, CVE reconstruction).
- Run
radiff2 -g main old new or Ghidra Version Tracking to correlate functions.
- Focus on functions with added
if / early-return → likely security fix.
- Verify the bug is reachable before claiming exploitability.
→ Full workflow with FLIRT, BinDiff, and symbol recovery: references/binary-diffing.md.
4. Firmware reversing
Goal: Extract filesystem, analyze embedded binaries, find backdoors.
Operator flow:
1. Triage: Identify firmware type (router, IoT, BIOS, etc.).
- Check magic bytes: uImage (0x27051956), vmlinux, squashfs, etc.
2. Extract: preserve/hash first, identify the outer format, then follow `references/firmware-rev.md` for isolated, bounded extraction.
3. Analyze filesystem:
- `squashfs-root/`: config files, web interfaces, binaries.
- Search for: hardcoded credentials, backdoor accounts, crypto keys.
4. Reverse embedded binaries:
- Identify arch: MIPS, ARM, AVR (use `radare2` or `ghidra`).
- Load in appropriate tool with correct base address.
5. Emulate (optional): QEMU user-mode for MIPS/ARM binaries.
Key tricks:
- Firmware often has: Telnet backdoors, hardcoded SNMP community strings, private keys.
- Web interfaces: check for command injection (ping, traceroute), path traversal.
- Embedded binaries may be stripped → use
radare2 zignatures or ghidra function ID.
- Check
/etc/passwd, /etc/shadow, SSH keys, certificate files.
Tool citations:
binwalk — signature scan, extraction, entropy analysis.
ghidra — analyze MIPS/ARM binaries, recover structs.
radare2 — headless analysis, scripting for batch processing.
frida — dynamic analysis if firmware runs on emulated device.
Common pitfalls:
- Wrong architecture → decompilation nonsense.
- Wrong base address → function calls go to invalid addresses.
- Ignoring filesystem configs → missing high-value IOCs.
5. .NET reversing (managed code)
Goal: Understand C#/VB.NET logic, bypass obfuscation, extract configs.
- Detect obfuscator:
de4dot --detect sample.exe
- Deobfuscate:
de4dot sample.exe -o clean.exe
- Analyze in
dnspy — start at Entry Point (Ctrl+Shift+K); set breakpoints on decryption/config load
- Watch for multi-stage loaders:
Assembly.Load() + GetManifestResourceStream call sites
- Network isolation is mandatory before dynamic debugging stealers/RATs
Key tools: dnspy (decompiler/debugger/patcher), de4dot (deobfuscation), ghidra (fallback).
→ Full deobfuscation table, ConfuserEx/Reactor flags, config extraction: references/dotnet-rev.md.
6. Protocol reversing
Goal: Reconstruct proprietary protocol, understand message format.
Operator flow:
1. Capture traffic: Wireshark, tcpdump, or `frida` SSL pinning bypass.
2. Triage: Identify protocol type (text, binary, encrypted).
- Look for magic bytes, length fields, checksums.
3. Static: Analyze client/server binaries in `ghidra`.
- Find send/recv functions → cross-reference to protocol handlers.
- Reconstruct structs from serialization code.
4. Dynamic: Hook send/recv with `frida` → log raw packets.
- Correlate with network capture.
5. Document: Message format, state machine, encryption (if any).
Key tricks:
- Text protocols: look for delimiters (
\n, |, ;) and command keywords.
- Binary protocols: look for length fields, magic bytes, checksums (CRC32, Adler32).
- Encryption: check for TLS, or custom crypto (XOR, AES) in binary.
- Use
frida to intercept before encryption/after decryption.
Tool citations:
ghidra — analyze protocol handlers, recover structs.
frida — hook send/recv, bypass SSL pinning.
wireshark — (external) packet analysis.
radare2 — headless protocol analysis scripting.
Common pitfalls:
- Assuming protocol is text → it's binary with magic bytes.
- Ignoring encryption → can't read payload without key.
- Not correlating static + dynamic → missing protocol state machine.
→ gRPC/protobuf/websocket/app-framing specifics and decoder bootstrap: references/protocol-rev.md.
7. Vulnerability hunting
Goal: Find bugs (buffer overflow, use-after-free, etc.) in closed-source.
Operator flow:
1. Recon: Identify attack surface, input channels, and hardening context.
- Parsers, network listeners, IPC, config importers, update handlers.
2. Static: Load in `ghidra` or `binaryninja`.
- Trace attacker-controlled data into size, offset, pointer, and format operations.
3. Classify the candidate primitive.
- Overflow, UAF/double-free, integer mis-sizing, format string, command construction.
4. Dynamic validation: Debug in `gdb`+`pwndbg` or `x64dbg`.
- Confirm branch reachability, memory/register side effects, and repeatability.
5. Symbolic execution: use `angr` for path exploration when manual analysis of branching logic is too slow — especially useful for complex key validation or constrained input recovery.
6. Fuzzing or targeted harness: Use AFL++, LibFuzzer (see `offensive-tools/fuzzing/`) if format knowledge will improve coverage.
7. Exploitability model: rank by control quality, mitigations, and environmental preconditions before claiming impact.
Key tricks:
- Focus on input parsers: file format readers, network packet handlers.
- Look for: integer overflows (size calculations), off-by-one errors.
- Use
checksec (in gdb+pwndbg) to see mitigations (NX, PIE, CANARY).
- Patch diffing helps: find recent CVE fixes → analyze vulnerability.
- Keep one controlled input per hypothesis so crash cause and side effects stay attributable.
- Write proof requirements early: what would count as a validated primitive vs a suspicious crash?
Tool citations:
ghidra, binaryninja — static analysis, decompilation.
gdb+pwndbg/gef — crash analysis, exploit debugging.
frida — runtime analysis, hooking.
angr — symbolic execution, path exploration, automated constraint solving for input recovery.
- AFL++, LibFuzzer — fuzzing (see
offensive-tools/fuzzing/).
Common pitfalls:
- Fuzzing without understanding input format → low coverage.
- Ignoring mitigations → exploit harder than expected.
- Not verifying exploitability → crash ≠ vulnerability.
- Claiming impact without proving reachability from a realistic input path.
- Missing config-dependent branches → the vulnerable path may be disabled in the default run.
7b. Exploitability triage and handoff
Goal: From a validated corruption primitive, qualify exploitability and hand a clean primitive to offensive-techniques/binary-exploitation-technique; do not build the chain here.
Qualify before handoff:
- Prove what is controlled (PC, stack pivot, arbitrary read/write, object/type confusion) and the bug family (overflow/UAF/type confusion/index/format string).
- Confirm deterministic, attacker-influenced reproduction under a fixed input path — a crash is not yet a primitive.
- Model the primitive's repeatability: read every branch of any state guard (
is_set, initialized, done, idx == fav). The else/already-set branch frequently still performs the gated read/write/free, so an apparently one-shot primitive is a repeatable arbitrary read/write loop. Confirm which branch runs on the second invocation before declaring a path dead.
- Inventory mitigations (
checksec, module headers): NX/DEP, ASLR/PIE, canary, RELRO, CFG/CET, allocator hardening — carry this into the handoff.
Tools: gdb+pwndbg/gef, x64dbg, windbg for control validation; angr for trigger-gating constraints; radare2/ghidra/binaryninja for gadget/function reachability.
→ Chain strategy, mitigation-aware planning, and reproducible proof: offensive-techniques/binary-exploitation-technique. Concrete recipes (ROP/heap/FSOP/format-string/one_gadget): offensive-ctf/pwn-ctf/references.
8. Secrets extraction
Goal: Recover hardcoded keys, passwords, tokens, C2 addresses.
Operator flow:
1. Triage: Strings (`strings`, `radare2` `iz`), look for:
- Crypto constants (AES S-box, RSA magic, base64 patterns).
- URLs, IPs, email addresses.
- High-entropy regions (likely encrypted/compressed).
2. Static: Find decryption routines in `ghidra`.
- Look for: XOR loops, AES key schedules, RC4 init.
- Cross-reference encrypted strings to decryption function.
3. Dynamic: Breakpoint on crypto APIs (`CryptEncrypt`, `BCryptEncrypt`).
- Dump memory after decryption (`x64dbg` memory dump).
4. Decode: Base64, hex, or emulate decryption in Python.
Key tricks:
- Secrets often: XORed with single byte, or AES with embedded key.
- C2 config: may be JSON/XML in resources, or encrypted blob.
- API keys/tokens: search for common patterns (
Bearer, api_key, secret).
- Use
radare2 to search for crypto constants: /R opcode for ROP, but for crypto search bytes.
Tool citations:
ghidra — identify crypto algorithms, recover keys.
radare2 — search patterns, script analysis.
x64dbg — runtime memory dump after decryption.
frida — hook crypto APIs, log plaintext.
Common pitfalls:
- Assuming strings are plaintext → they're decrypted at runtime.
- Not checking resources → secrets hidden in embedded data.
- Ignoring TLS traffic → C2 communication encrypted.
9. JavaScript / browser extension reversing
Goal: Understand web application logic, browser extensions, or obfuscated JS payloads.
Operator flow:
1. Triage: Is it a browser extension (zip/crx), single-page app bundle, or obfuscated script?
2. Extract:
- Browser extension: rename .crx → .zip → extract.
- SPA bundle: download the main JS bundle via DevTools → Sources.
3. Deobfuscate:
- Run through JS beautifier (js-beautify, Prettier).
- For eval-obfuscated/string-array obfuscation: use de-obfuscation pass (obfuscator.io reverse, webcrack, deobfuscate.io).
- For packed bundles (webpack/rollup): look for chunk map → identify module boundaries.
4. Static analysis: Browser DevTools or VS Code → search for:
- Sensitive strings: API keys, endpoints, tokens.
- Crypto calls: subtle.crypto, CryptoJS, forge.
- Eval / dynamic code execution.
5. Dynamic: DevTools debugger → breakpoint on XHR/fetch, DOM mutation, or suspicious function.
- Intercept requests via proxy (mitmproxy).
- Patch eval'd payloads with live overrides (DevTools override feature).
6. Manifest audit (extensions): check `permissions`, `content_scripts`, `background`, `externally_connectable`.
Key tricks:
- Webpack bundles expose
__webpack_require__ — iterate module map to enumerate all modules.
- Chrome extension background workers: debug via
chrome://extensions → inspect background page.
- Eval-hidden payloads: override
eval at load time to log all executed strings.
- API key extraction: search for
Authorization, api_key, Bearer, X-Api-Key.
Tool citations:
- Browser DevTools — primary debugger and network inspector.
frida — inject into Electron/Node.js apps using the browser engine.
mitmproxy (offensive-tools/network/mitmproxy/) — intercept and replay browser-initiated requests.
radare2 / ghidra — if JS engine (V8) is compiled into a native binary.
→ MV2/MV3 entry points, permission-risk triage, messaging edges, and nativeMessaging / externally_connectable audit: references/browser-extension-rev.md.
Anti-reverse engineering bypass
Common techniques and countermeasures
| Technique |
What it does |
Bypass method |
Tool reference |
| PEB.BeingDebugged |
Checks PEB flag |
Patch byte at PEB+0x02 to 0 |
x64dbg, ScyllaHide |
| NtGlobalFlag |
Sets heap flags for debugging |
Clear flag at PEB+0x68 (32-bit) |
x64dbg, ScyllaHide |
| RDTSC timing |
Measures CPU cycles for debugger |
Patch or emulate |
frida hook |
| FindWindow/Process |
Detects debugger windows |
Hook with frida or NOP |
x64dbg |
| CRC/integrity |
Checks code section hashes |
Patch check or suspend thread |
x64dbg breakpoint |
| VM detection |
Detects VirtualBox/VMware |
Use real hardware or hide with VM detection bypass |
ScyllaHide |
| Anti-dump |
Prevents memory dumping |
Use Scylla for IAT fix |
x64dbg + Scylla |
| Obfuscation (.NET) |
Renames, control flow, constants |
Use de4dot, dnSpy decompile |
dnspy |
Unpacking workflow
1. Detect packer: DIE, PEiD, or manual (section names, entry point).
2. Static: Find OEP (Original Entry Point) via:
- Pushad/popad patterns (UPX).
- Call to GetProcAddress/LoadLibrary (custom).
3. Dynamic: Set breakpoint on VirtualAlloc (for RWX memory).
- When hit, check size arg → likely unpacked code destination.
- Set hardware execute BP on returned address.
- Run → break at OEP (unpacked code).
4. Dump: Use `Scylla` (x64dbg plugin) or `radare2` `om`.
5. Fix IAT: Reconstruct imports with `Scylla` or manual.
Operator checklist (per objective)
Each objective workflow in §1–9 plus §7b contains a full step-by-step flow. Quick gate:
- Triage complete before deep static analysis.
- Objective defined before tool selection.
- Isolated environment for dynamic analysis.
- Static findings validated dynamically; dynamic assumptions confirmed statically.
- Reproducible notes (hashes, tool versions, environment) captured for reporting.
Common pitfalls (all objectives)
- Analysis paralysis: Disassembling everything without objective.
- Trusting decoys: Strings may be encrypted, fake, or irrelevant.
- Skipping triage: Wasting time on packed/encrypted code.
- No isolation: Dynamic analysis on host → infection/compromise.
- Confirmation bias: Ignoring evidence contradicting hypothesis.
- Tool fixation: Using wrong tool for binary type (e.g.,
x64dbg for ELF).
- Ignoring anti-analysis: Debugger detected, malware exits silently.
Tool selection quick reference
| Objective |
Primary tools (see offensive-tools/rev/) |
Environment |
| Malware (Windows) |
ghidra, x64dbg, frida, capa |
Windows VM |
| Malware (Linux) |
ghidra, gdb+pwndbg, radare2, capa |
Linux VM/WSL |
| Software protection (Windows) |
ghidra, x64dbg, dnspy (.NET) |
Windows |
| Patch diffing |
ghidra (Version Tracking), radare2 (radiff2) |
Cross-platform |
| Firmware |
binwalk, ghidra, radare2 |
Linux |
| .NET reversing |
dnspy, de4dot |
Windows |
| Protocol RE |
ghidra, frida, mitmproxy |
Depends |
| Vulnerability hunting |
ghidra/binaryninja, gdb, AFL++ |
Linux/Windows |
Exploitability triage (→ binary-exploitation-technique) |
gdb+pwndbg/gef, x64dbg, windbg, checksec |
Linux/Windows |
| JS/Browser extension |
DevTools, frida, mitmproxy |
Browser/Electron |
| Kernel/crash dump |
windbg |
Windows |
Resources
Core sequence:
- references/triage.md — start here for the first 5–10 minutes: format detection, entropy, imports, language/runtime fingerprints, and next-step decisioning.
- references/re-workflow.md — core methodology after triage: static, dynamic, reconstruction, Ghidra workflow, crypto-pattern spotting, and reporting.
Format supplements:
- references/pe-rev.md — PE-only pivots: RVA/raw mapping, data directories, TLS/CRT pre-entry paths, IAT/EAT/delay imports, resources/overlay/Authenticode, unpacking, and mitigation handoff.
- references/elf-rev.md — ELF-only pivots: program headers, dynamic entries, PLT/GOT/relocations, RELRO/ASLR, symbol versioning, IFUNC/constructors, loader instrumentation, and packer/runtime surfaces.
- references/dotnet-rev.md — managed-assembly workflow: deobfuscation order, resource/config extraction, stage loading, and managed/native handoff.
- references/firmware-rev.md — firmware container workflow: format-first bounded extraction, filesystem/control-plane mapping, startup review, and emulation handoff.
Problem-specific deep dives:
references/anti-analysis.md — Linux/Windows anti-debug, anti-VM, anti-DBI, code integrity, anti-disassembly, MBA, Heaven's Gate Linux, and bypass strategies.
references/custom-vm.md — custom VM reversing, nanomites, self-modifying code, metamorphic decrypt loops, lattice/linear-algebra solving, side-channel attacks, and emulation frameworks.
references/ransomware-re.md — ransomware crypto workflow: hybrid model, Windows CryptoAPI/CNG/OpenSSL identification, implementation flaw checklist, encrypted-file analysis, public-key extraction, and YARA skeleton.
references/languages.md — language/runtime pivots for Go, Rust (crate fingerprinting), Python bytecode (PyInstaller/PyArmor), Nim, VBS/WSH, Unity IL2CPP, and HarmonyOS HAP.
references/protocol-rev.md — capture-first custom protocol reversing: text vs binary framing, gRPC/protobuf decoding, WebSocket/app-frame separation, and minimal parser outputs.
references/browser-extension-rev.md — Chrome/Edge/Firefox extension workflow: MV2/MV3 entry points, permission-risk triage, content-script isolation, messaging edges, storage, and nativeMessaging.
references/binary-diffing.md — binary diff workflow (radiff2, Ghidra VT, BinDiff, ghidriff), FLIRT signature generation, Ghidra FID for stripped library symbol recovery, and Windows Update MSU/CAB acquisition + PA30 delta reconstruction for n-day patch diffing.
Exploitability handoff: once a primitive is confirmed, offensive-techniques/binary-exploitation-technique owns the chaining methodology and offensive-ctf/pwn-ctf/references holds the concrete recipes.
references/rootkit-and-bootkit-re.md — Windows/Linux kernel-mode RE, driver/module triage, bootkit workflow, hook/callback analysis, and boot-chain evidence.
references/nim-rev.md — Nim binary recognition, symbol recovery, GC/memory layout, decompilation patterns, stripped binary workflow.
references/node-v8-snapshots.md — Node.js pkg/SEA/nexe extraction, V8 startup snapshot recovery, JS deobfuscation.
references/in-memory-loading.md — Linux fileless loading via memfd_create + dlopen: detection, runtime dump, layer separation.
offensive-tools/forensic/capa/ — capability-based binary classification (TTP/family detection).
1---2name: reversing-technique3description: Auth/lab: reverse engineering methodology; malware triage, patch diffing, firmware/protocol RE, protections, exploitability handoff evidence.4license: MIT5---67# Reverse Engineering Technique89**Extract actionable intelligence efficiently** by adapting workflow to your objective.1011## When to activate1213- **Malware analysis**: Understand behavior, C2, persistence, evasion.14- **Software protection analysis**: Identify license/protection logic, emulate validation checks, reconstruct key material where authorized.15- **Patch diffing**: Find security fixes, understand vendor patches.16- **Firmware reversing**: Extract filesystems, analyze embedded code.17- **.NET reversing**: Deobfuscate, understand managed code logic.18- **Protocol reversing**: Reconstruct proprietary protocols or file formats.19- **Vulnerability hunting**: Find bugs in closed-source components.20- **Exploitability triage**: Qualify a corruption primitive found during RE, then hand off to `binary-exploitation-technique` for chaining and proof.21- **Secrets extraction**: Recover keys, tokens, passwords.22- **Custom VM / obfuscation**: Binary has a bytecode VM, LLVM CFF dispatcher, or VMProtect/Themida packing.23- **Anti-analysis bypass**: Binary exits under debugger, detects VM, crashes analysis tools, or uses signal-handler tricks.24- **Side-channel RE**: Validation timing, instruction count, or signal behavior leaks per-character correctness.25- **Language-specific RE**: Go, Rust, Python bytecode, Unity IL2CPP, Nim, VBS/WSH, Node.js/V8 snapshots requires language-specific tooling (see `references/languages.md`, `references/nim-rev.md`, `references/node-v8-snapshots.md`).26- **In-memory loading**: Linux binary loads a second-stage ELF via `memfd_create` + `dlopen` (fileless; see `references/in-memory-loading.md`).2728## Initial triage2930Before diving deep, classify the artifact and the operator objective so the workflow starts in the right lane.3132- **Starting state**: is the target malware, protected software, firmware, a managed assembly, a protocol artifact, a crash primitive, or an unknown binary?33- **First questions**: what do you need to learn first, what architecture/runtime/packing signals are present, and is static or dynamic evidence the fastest way to reduce uncertainty?34- **Immediate actions**: perform fast format/entropy/import/string triage, assign the objective workflow, and only then choose the decompiler/debugger/tooling mix.35- **Tool-family direction**: start with CLI/static triage families (`radare2`, `objdump`, `readelf`, `strings`, `capa`, `binwalk`) and escalate to heavy decompilation/debugging (`ghidra`, `binaryninja`, `gdb`, `x64dbg`, `windbg`, `dnspy`, `frida`) once the goal is defined.36- **Escalation rule**: objective first, tool second; do not decompile everything before deciding what question you are answering.3738## Core methodology3940```411. Triage (5-10 min): Quick assessment before deep dive.422. Define objective: What do you need to know?433. Select tools: Based on binary type, objective, environment.444. Static analysis: Structure understanding without execution.455. Dynamic analysis: Validate assumptions via runtime behavior.466. Synthesis: Pseudocode, documentation, or exploit.477. Verification: Test findings; iterate if needed.48```4950## Triage (first 5-10 minutes)5152Quick assessment to decide approach:5354| Check | Tool reference | What to look for |55|-------|-----------------|-------------|56| File type | `file`, `detect-it-easy` | PE/ELF/Mach-O/.NET, arch, bits |57| Packers/obfuscation | `Detect It Easy`, `binwalk` | UPX, ASPack, ConfuserEx, high entropy |58| Strings | `strings`, `radare2` (`iz`) | URLs, IPs, registry keys, crypto constants |59| Imports/exports | `radare2` (`ii`, `ie`), `ghidra` | Suspicious APIs, crypto, network, process |60| Metadata | `pefile`, `radare2` (`iI`) | Timestamps, version, compiler, PDB |61| Hashes | `sha256sum`, `rahash2` | Submit to VirusTotal, MalwareBazaar |62| Capabilities | `capa` (`offensive-tools/forensic/capa/`) | TTP fingerprint, malware family, embedded shellcode |6364**Decision tree:**65- High entropy + suspicious imports → **Malware analysis** workflow66- Protection messages (registration, trial, activation) → **Software protection** workflow67- Two versions of same binary → **Patch diffing** workflow68- Firmware header (uImage, vmlinux) → **Firmware** workflow69- .NET assembly → **.NET reversing** workflow70- Network capture + unknown protocol → **Protocol RE** workflow71- Large `switch(opcode)` + byte-buffer IP loop → **Custom VM** workflow (see `references/custom-vm.md`)72- `fork()` + `ptrace(TRACEME)` or `SIGTRAP`/`SIGFPE` signal loop → **Nanomites** (see `references/custom-vm.md §2`)73- Binary exits/behaves differently under debugger or in VM → **Anti-analysis bypass** (see `references/anti-analysis.md`)74- Validation response varies by character (timing/count) → **Side-channel RE** (see `references/custom-vm.md §4`)75- Go buildid / Rust `__rust_panic` / `.pyc` file → **Language-specific RE** (see `references/languages.md`)76- LLVM control flow flattening (dispatcher switch, state variable) → `references/custom-vm.md §6`77- VMProtect / Themida packing detected → dump after OEP (see `references/anti-analysis.md §unpacking`)78- `NimMain` / `HEXnn` mangled names / `@[` slice constants → **Nim RE** (see `references/nim-rev.md`)79- `pkg/prelude` / `NODE_SEA_FUSE` / `snapshot_blob` in strings → **Node.js/V8 snapshot** (see `references/node-v8-snapshots.md`)80- `memfd_create` in strace / `/proc/self/fd/` path to `dlopen` → **In-memory loading** (see `references/in-memory-loading.md`)81- `ljmp 0x33:` / `push 0x33; retf` in 32-bit ELF → **Heaven's Gate Linux** (see `references/anti-analysis.md §Category 8`)82- PCAP / protobuf / gRPC / grpc-web / WebSocket frames / length-prefixed binary RPC → **Protocol reversing** (see `references/protocol-rev.md`)83- `.crx` / `.xpi` / `manifest.json` / MV3 service worker / `content_scripts` / `externally_connectable` → **Browser extension reversing** (see `references/browser-extension-rev.md`)84- Two binary versions for patch analysis / a single Microsoft Patch-Tuesday MSU to reconstruct / stripped library with unknown symbols → **Binary diffing / FLIRT** (see `references/binary-diffing.md`)85- Confirmed overwrite primitive with partial control over RIP/EIP/PC, heap metadata, or function pointer → **Exploitability triage** (§7b), then hand off to `offensive-techniques/binary-exploitation-technique`86- Kernel driver/module, hidden artifacts, boot-chain tampering, or EFI/bootloader changes → **Rootkit / bootkit RE** workflow (see `references/rootkit-and-bootkit-re.md`)8788## CLI-first tool preference8990Prefer CLI/scriptable tooling for triage, batch work, and repeatable evidence. Move to GUI decompilers/debuggers when semantics, types, or interaction speed justify it.9192| Need | Prefer first | GUI/decompiler escalation |93|---|---|---|94| File metadata, imports, sections, strings | `rabin2`, `radare2`, `objdump`, `readelf`, `strings` | Ghidra/Binary Ninja project when structure matters |95| Fast static triage | `radare2` (`aaa`, `afl`, `iz`, `ii`, `iS`), `capa` | Ghidra for decompilation and type recovery |96| Linux dynamic behavior | `strace`, `ltrace`, `gdb` | Ghidra debugger only if needed |97| Windows crash/debug | `windbg`/`cdb` for dump triage | `x64dbg` for interactive patch/trace |98| Firmware extraction | `binwalk` CLI first | Ghidra/radare2 per extracted binary |99| .NET | `de4dot`/CLI metadata first | `dnspy` for decompile/debug/patch |100101Formal tool skills: `offensive-tools/rev/radare2/`, `offensive-tools/rev/gdb/`, `offensive-tools/rev/frida/`, `offensive-tools/rev/binwalk/`, `offensive-tools/rev/ghidra/`, `offensive-tools/rev/binaryninja/`, `offensive-tools/rev/dnspy/`, `offensive-tools/rev/windbg/`, `offensive-tools/rev/x64dbg/`, plus `offensive-tools/forensic/capa/` for capability triage.102103## Objective-driven workflows104105### 1. Malware analysis106107**Goal**: Understand behavior, extract IOCs, identify C2, assess threat.108109**Operator flow:**110```1111. Triage: strings, imports, VirusTotal, Any.Run sandbox report.1122. Static: Load in `ghidra` or `radare2` → auto-analysis.113 - Check imports for: VirtualAlloc, CreateRemoteThread, WriteProcessMemory.114 - Cross-reference suspicious strings (URLs, IPs, registry paths).115 - Identify decryption routines (loops with XOR/RC4/AES).1163. Dynamic: Debug in `x64dbg` (Windows) or `gdb`+`pwndbg` (Linux).117 - Set breakpoints on crypto APIs, network APIs.118 - Dump decrypted strings/config from memory.119 - Monitor: Process Monitor, Wireshark, ProcMon.120 - Linux: use `strace -e trace=network,file` to log syscalls without a debugger; `ltrace` for library call interception.1214. Unpack if packed: Use `x64dbg` + Scylla, or `binwalk` for firmware.1225. Report: IOCs, TTPs, C2 config, YARA rules.123```124125**Key tricks:**126- Decryption routines often precede string usage—trace backwards from strings.127- Config often in resources or appended to binary—check `binwalk`, `radare2` (`iS`).128- Anti-debug: PEB.BeingDebugged, NtGlobalFlag, RDTSC—use `ScyllaHide` or patch.129- C2 often encrypted with simple XOR—search for XOR loops with constant key.130131**Key tools:** `capa` (TTP triage), `ghidra`/`radare2` (static), `x64dbg`/`gdb`+`pwndbg` (dynamic), `frida` (hooking), `binwalk` (unpacking), `strace`/`ltrace` (Linux syscall/lib tracing), `windbg` (crash dumps).132133→ Full workflow: `references/re-workflow.md`. Anti-debug bypass: `references/anti-analysis.md`.134135---136137### 2. Software protection bypass and licensing emulation138139**Goal**: Understand license/protection checks, emulate validation, and produce authorized proof of bypass or key-generation logic.140141**Operator flow:**142```1431. Triage: Identify protection (ASProtect, Themida, custom).1442. Static: Load in `ghidra` → find protection strings, error messages.145 - Search for: "Invalid key", "Trial expired", "Wrong password".146 - Cross-reference strings to validation functions.1473. Dynamic: Debug in `x64dbg` or `radare2` debugger.148 - Set breakpoint on validation function or message box.149 - Trace backwards to find comparison logic.150 - Patch: NOP conditional jump, or change return value.1514. Key reconstruction: Understand algorithm from decompiled code.152 - Reconstruct in Python/C based on pseudocode.1535. Verify: Patched binary accepts valid key.154```155156**Key tricks:** Cross-ref error strings to validation functions; NOP/invert the final comparison; watch for CRC re-checks after patching.157158**Key tools:** `ghidra` (decompile validation), `x64dbg` (patch jumps), `frida` (hook online activation), `dnspy` (.NET).159160→ Unpacking details: `references/anti-analysis.md §unpacking`. Binary diffing: `references/binary-diffing.md`.161162---163164### 3. Patch diffing165166**Goal**: Find what changed between two binary versions (security patch, CVE reconstruction).167168- Run `radiff2 -g main old new` or Ghidra Version Tracking to correlate functions.169- Focus on functions with added `if` / early-return → likely security fix.170- Verify the bug is reachable before claiming exploitability.171172→ Full workflow with FLIRT, BinDiff, and symbol recovery: `references/binary-diffing.md`.173174---175176### 4. Firmware reversing177178**Goal**: Extract filesystem, analyze embedded binaries, find backdoors.179180**Operator flow:**181```1821. Triage: Identify firmware type (router, IoT, BIOS, etc.).183 - Check magic bytes: uImage (0x27051956), vmlinux, squashfs, etc.1842. Extract: preserve/hash first, identify the outer format, then follow `references/firmware-rev.md` for isolated, bounded extraction.1853. Analyze filesystem:186 - `squashfs-root/`: config files, web interfaces, binaries.187 - Search for: hardcoded credentials, backdoor accounts, crypto keys.1884. Reverse embedded binaries:189 - Identify arch: MIPS, ARM, AVR (use `radare2` or `ghidra`).190 - Load in appropriate tool with correct base address.1915. Emulate (optional): QEMU user-mode for MIPS/ARM binaries.192```193194**Key tricks:**195- Firmware often has: Telnet backdoors, hardcoded SNMP community strings, private keys.196- Web interfaces: check for command injection (ping, traceroute), path traversal.197- Embedded binaries may be stripped → use `radare2` zignatures or `ghidra` function ID.198- Check `/etc/passwd`, `/etc/shadow`, SSH keys, certificate files.199200**Tool citations:**201- `binwalk` — signature scan, extraction, entropy analysis.202- `ghidra` — analyze MIPS/ARM binaries, recover structs.203- `radare2` — headless analysis, scripting for batch processing.204- `frida` — dynamic analysis if firmware runs on emulated device.205206**Common pitfalls:**207- Wrong architecture → decompilation nonsense.208- Wrong base address → function calls go to invalid addresses.209- Ignoring filesystem configs → missing high-value IOCs.210211---212213### 5. .NET reversing (managed code)214215**Goal**: Understand C#/VB.NET logic, bypass obfuscation, extract configs.2162171. Detect obfuscator: `de4dot --detect sample.exe`2182. Deobfuscate: `de4dot sample.exe -o clean.exe`2193. Analyze in `dnspy` — start at Entry Point (Ctrl+Shift+K); set breakpoints on decryption/config load2204. Watch for multi-stage loaders: `Assembly.Load()` + `GetManifestResourceStream` call sites2215. Network isolation is mandatory before dynamic debugging stealers/RATs222223**Key tools:** `dnspy` (decompiler/debugger/patcher), `de4dot` (deobfuscation), `ghidra` (fallback).224225→ Full deobfuscation table, ConfuserEx/Reactor flags, config extraction: `references/dotnet-rev.md`.226227---228229### 6. Protocol reversing230231**Goal**: Reconstruct proprietary protocol, understand message format.232233**Operator flow:**234```2351. Capture traffic: Wireshark, tcpdump, or `frida` SSL pinning bypass.2362. Triage: Identify protocol type (text, binary, encrypted).237 - Look for magic bytes, length fields, checksums.2383. Static: Analyze client/server binaries in `ghidra`.239 - Find send/recv functions → cross-reference to protocol handlers.240 - Reconstruct structs from serialization code.2414. Dynamic: Hook send/recv with `frida` → log raw packets.242 - Correlate with network capture.2435. Document: Message format, state machine, encryption (if any).244```245246**Key tricks:**247- Text protocols: look for delimiters (`\n`, `|`, `;`) and command keywords.248- Binary protocols: look for length fields, magic bytes, checksums (CRC32, Adler32).249- Encryption: check for TLS, or custom crypto (XOR, AES) in binary.250- Use `frida` to intercept before encryption/after decryption.251252**Tool citations:**253- `ghidra` — analyze protocol handlers, recover structs.254- `frida` — hook send/recv, bypass SSL pinning.255- `wireshark` — (external) packet analysis.256- `radare2` — headless protocol analysis scripting.257258**Common pitfalls:**259- Assuming protocol is text → it's binary with magic bytes.260- Ignoring encryption → can't read payload without key.261- Not correlating static + dynamic → missing protocol state machine.262263→ gRPC/protobuf/websocket/app-framing specifics and decoder bootstrap: `references/protocol-rev.md`.264265---266267### 7. Vulnerability hunting268269**Goal**: Find bugs (buffer overflow, use-after-free, etc.) in closed-source.270271**Operator flow:**272```2731. Recon: Identify attack surface, input channels, and hardening context.274 - Parsers, network listeners, IPC, config importers, update handlers.2752. Static: Load in `ghidra` or `binaryninja`.276 - Trace attacker-controlled data into size, offset, pointer, and format operations.2773. Classify the candidate primitive.278 - Overflow, UAF/double-free, integer mis-sizing, format string, command construction.2794. Dynamic validation: Debug in `gdb`+`pwndbg` or `x64dbg`.280 - Confirm branch reachability, memory/register side effects, and repeatability.2815. Symbolic execution: use `angr` for path exploration when manual analysis of branching logic is too slow — especially useful for complex key validation or constrained input recovery.2826. Fuzzing or targeted harness: Use AFL++, LibFuzzer (see `offensive-tools/fuzzing/`) if format knowledge will improve coverage.2837. Exploitability model: rank by control quality, mitigations, and environmental preconditions before claiming impact.284```285286**Key tricks:**287- Focus on input parsers: file format readers, network packet handlers.288- Look for: integer overflows (size calculations), off-by-one errors.289- Use `checksec` (in `gdb`+`pwndbg`) to see mitigations (NX, PIE, CANARY).290- Patch diffing helps: find recent CVE fixes → analyze vulnerability.291- Keep one controlled input per hypothesis so crash cause and side effects stay attributable.292- Write proof requirements early: what would count as a validated primitive vs a suspicious crash?293294**Tool citations:**295- `ghidra`, `binaryninja` — static analysis, decompilation.296- `gdb`+`pwndbg`/`gef` — crash analysis, exploit debugging.297- `frida` — runtime analysis, hooking.298- `angr` — symbolic execution, path exploration, automated constraint solving for input recovery.299- AFL++, LibFuzzer — fuzzing (see `offensive-tools/fuzzing/`).300301**Common pitfalls:**302- Fuzzing without understanding input format → low coverage.303- Ignoring mitigations → exploit harder than expected.304- Not verifying exploitability → crash ≠ vulnerability.305- Claiming impact without proving reachability from a realistic input path.306- Missing config-dependent branches → the vulnerable path may be disabled in the default run.307308---309310### 7b. Exploitability triage and handoff311312**Goal**: From a validated corruption primitive, qualify exploitability and hand a clean primitive to `offensive-techniques/binary-exploitation-technique`; do not build the chain here.313314**Qualify before handoff:**315- Prove what is controlled (PC, stack pivot, arbitrary read/write, object/type confusion) and the bug family (overflow/UAF/type confusion/index/format string).316- Confirm deterministic, attacker-influenced reproduction under a fixed input path — a crash is not yet a primitive.317- Model the primitive's *repeatability*: read every branch of any state guard (`is_set`, `initialized`, `done`, `idx == fav`). The `else`/already-set branch frequently still performs the gated read/write/free, so an apparently one-shot primitive is a repeatable arbitrary read/write loop. Confirm which branch runs on the second invocation before declaring a path dead.318- Inventory mitigations (`checksec`, module headers): NX/DEP, ASLR/PIE, canary, RELRO, CFG/CET, allocator hardening — carry this into the handoff.319320**Tools:** `gdb`+`pwndbg`/`gef`, `x64dbg`, `windbg` for control validation; `angr` for trigger-gating constraints; `radare2`/`ghidra`/`binaryninja` for gadget/function reachability.321322→ Chain strategy, mitigation-aware planning, and reproducible proof: `offensive-techniques/binary-exploitation-technique`. Concrete recipes (ROP/heap/FSOP/format-string/one_gadget): `offensive-ctf/pwn-ctf/references`.323324---325326### 8. Secrets extraction327328**Goal**: Recover hardcoded keys, passwords, tokens, C2 addresses.329330**Operator flow:**331```3321. Triage: Strings (`strings`, `radare2` `iz`), look for:333 - Crypto constants (AES S-box, RSA magic, base64 patterns).334 - URLs, IPs, email addresses.335 - High-entropy regions (likely encrypted/compressed).3362. Static: Find decryption routines in `ghidra`.337 - Look for: XOR loops, AES key schedules, RC4 init.338 - Cross-reference encrypted strings to decryption function.3393. Dynamic: Breakpoint on crypto APIs (`CryptEncrypt`, `BCryptEncrypt`).340 - Dump memory after decryption (`x64dbg` memory dump).3414. Decode: Base64, hex, or emulate decryption in Python.342```343344**Key tricks:**345- Secrets often: XORed with single byte, or AES with embedded key.346- C2 config: may be JSON/XML in resources, or encrypted blob.347- API keys/tokens: search for common patterns (`Bearer`, `api_key`, `secret`).348- Use `radare2` to search for crypto constants: `/R opcode` for ROP, but for crypto search bytes.349350**Tool citations:**351- `ghidra` — identify crypto algorithms, recover keys.352- `radare2` — search patterns, script analysis.353- `x64dbg` — runtime memory dump after decryption.354- `frida` — hook crypto APIs, log plaintext.355356**Common pitfalls:**357- Assuming strings are plaintext → they're decrypted at runtime.358- Not checking resources → secrets hidden in embedded data.359- Ignoring TLS traffic → C2 communication encrypted.360361---362363### 9. JavaScript / browser extension reversing364365**Goal**: Understand web application logic, browser extensions, or obfuscated JS payloads.366367**Operator flow:**368```3691. Triage: Is it a browser extension (zip/crx), single-page app bundle, or obfuscated script?3702. Extract:371 - Browser extension: rename .crx → .zip → extract.372 - SPA bundle: download the main JS bundle via DevTools → Sources.3733. Deobfuscate:374 - Run through JS beautifier (js-beautify, Prettier).375 - For eval-obfuscated/string-array obfuscation: use de-obfuscation pass (obfuscator.io reverse, webcrack, deobfuscate.io).376 - For packed bundles (webpack/rollup): look for chunk map → identify module boundaries.3774. Static analysis: Browser DevTools or VS Code → search for:378 - Sensitive strings: API keys, endpoints, tokens.379 - Crypto calls: subtle.crypto, CryptoJS, forge.380 - Eval / dynamic code execution.3815. Dynamic: DevTools debugger → breakpoint on XHR/fetch, DOM mutation, or suspicious function.382 - Intercept requests via proxy (mitmproxy).383 - Patch eval'd payloads with live overrides (DevTools override feature).3846. Manifest audit (extensions): check `permissions`, `content_scripts`, `background`, `externally_connectable`.385```386387**Key tricks:**388- Webpack bundles expose `__webpack_require__` — iterate module map to enumerate all modules.389- Chrome extension background workers: debug via `chrome://extensions` → inspect background page.390- Eval-hidden payloads: override `eval` at load time to log all executed strings.391- API key extraction: search for `Authorization`, `api_key`, `Bearer`, `X-Api-Key`.392393**Tool citations:**394- Browser DevTools — primary debugger and network inspector.395- `frida` — inject into Electron/Node.js apps using the browser engine.396- `mitmproxy` (`offensive-tools/network/mitmproxy/`) — intercept and replay browser-initiated requests.397- `radare2` / `ghidra` — if JS engine (V8) is compiled into a native binary.398399→ MV2/MV3 entry points, permission-risk triage, messaging edges, and nativeMessaging / externally_connectable audit: `references/browser-extension-rev.md`.400401---402403## Anti-reverse engineering bypass404405### Common techniques and countermeasures406407| Technique | What it does | Bypass method | Tool reference |408|------------|--------------|---------------|-----------------|409| PEB.BeingDebugged | Checks PEB flag | Patch byte at PEB+0x02 to 0 | `x64dbg`, `ScyllaHide` |410| NtGlobalFlag | Sets heap flags for debugging | Clear flag at PEB+0x68 (32-bit) | `x64dbg`, `ScyllaHide` |411| RDTSC timing | Measures CPU cycles for debugger | Patch or emulate | `frida` hook |412| FindWindow/Process | Detects debugger windows | Hook with `frida` or NOP | `x64dbg` |413| CRC/integrity | Checks code section hashes | Patch check or suspend thread | `x64dbg` breakpoint |414| VM detection | Detects VirtualBox/VMware | Use real hardware or hide with VM detection bypass | `ScyllaHide` |415| Anti-dump | Prevents memory dumping | Use `Scylla` for IAT fix | `x64dbg` + Scylla |416| Obfuscation (.NET) | Renames, control flow, constants | Use `de4dot`, `dnSpy` decompile | `dnspy` |417418### Unpacking workflow419420```4211. Detect packer: DIE, PEiD, or manual (section names, entry point).4222. Static: Find OEP (Original Entry Point) via:423 - Pushad/popad patterns (UPX).424 - Call to GetProcAddress/LoadLibrary (custom).4253. Dynamic: Set breakpoint on VirtualAlloc (for RWX memory).426 - When hit, check size arg → likely unpacked code destination.427 - Set hardware execute BP on returned address.428 - Run → break at OEP (unpacked code).4294. Dump: Use `Scylla` (x64dbg plugin) or `radare2` `om`.4305. Fix IAT: Reconstruct imports with `Scylla` or manual.431```432433## Operator checklist (per objective)434435Each objective workflow in §1–9 plus §7b contains a full step-by-step flow. Quick gate:436437- Triage complete before deep static analysis.438- Objective defined before tool selection.439- Isolated environment for dynamic analysis.440- Static findings validated dynamically; dynamic assumptions confirmed statically.441- Reproducible notes (hashes, tool versions, environment) captured for reporting.442443## Common pitfalls (all objectives)444445- **Analysis paralysis**: Disassembling everything without objective.446- **Trusting decoys**: Strings may be encrypted, fake, or irrelevant.447- **Skipping triage**: Wasting time on packed/encrypted code.448- **No isolation**: Dynamic analysis on host → infection/compromise.449- **Confirmation bias**: Ignoring evidence contradicting hypothesis.450- **Tool fixation**: Using wrong tool for binary type (e.g., `x64dbg` for ELF).451- **Ignoring anti-analysis**: Debugger detected, malware exits silently.452453## Tool selection quick reference454455| Objective | Primary tools (see `offensive-tools/rev/`) | Environment |456|-----------|------------------------------------------|------------|457| Malware (Windows) | `ghidra`, `x64dbg`, `frida`, `capa` | Windows VM |458| Malware (Linux) | `ghidra`, `gdb`+`pwndbg`, `radare2`, `capa` | Linux VM/WSL |459| Software protection (Windows) | `ghidra`, `x64dbg`, `dnspy` (.NET) | Windows |460| Patch diffing | `ghidra` (Version Tracking), `radare2` (`radiff2`) | Cross-platform |461| Firmware | `binwalk`, `ghidra`, `radare2` | Linux |462| .NET reversing | `dnspy`, `de4dot` | Windows |463| Protocol RE | `ghidra`, `frida`, `mitmproxy` | Depends |464| Vulnerability hunting | `ghidra`/`binaryninja`, `gdb`, AFL++ | Linux/Windows |465| Exploitability triage (→ `binary-exploitation-technique`) | `gdb`+`pwndbg`/`gef`, `x64dbg`, `windbg`, `checksec` | Linux/Windows |466| JS/Browser extension | DevTools, `frida`, `mitmproxy` | Browser/Electron |467| Kernel/crash dump | `windbg` | Windows |468469## Resources470471**Core sequence:**472473- [references/triage.md](references/triage.md) — start here for the first 5–10 minutes: format detection, entropy, imports, language/runtime fingerprints, and next-step decisioning.474- [references/re-workflow.md](references/re-workflow.md) — core methodology after triage: static, dynamic, reconstruction, Ghidra workflow, crypto-pattern spotting, and reporting.475476**Format supplements:**477478- [references/pe-rev.md](references/pe-rev.md) — PE-only pivots: RVA/raw mapping, data directories, TLS/CRT pre-entry paths, IAT/EAT/delay imports, resources/overlay/Authenticode, unpacking, and mitigation handoff.479- [references/elf-rev.md](references/elf-rev.md) — ELF-only pivots: program headers, dynamic entries, PLT/GOT/relocations, RELRO/ASLR, symbol versioning, IFUNC/constructors, loader instrumentation, and packer/runtime surfaces.480- [references/dotnet-rev.md](references/dotnet-rev.md) — managed-assembly workflow: deobfuscation order, resource/config extraction, stage loading, and managed/native handoff.481- [references/firmware-rev.md](references/firmware-rev.md) — firmware container workflow: format-first bounded extraction, filesystem/control-plane mapping, startup review, and emulation handoff.482483**Problem-specific deep dives:**484485- [references/anti-analysis.md](references/anti-analysis.md) — Linux/Windows anti-debug, anti-VM, anti-DBI, code integrity, anti-disassembly, MBA, Heaven's Gate Linux, and bypass strategies.486- [references/custom-vm.md](references/custom-vm.md) — custom VM reversing, nanomites, self-modifying code, metamorphic decrypt loops, lattice/linear-algebra solving, side-channel attacks, and emulation frameworks.487- [references/ransomware-re.md](references/ransomware-re.md) — ransomware crypto workflow: hybrid model, Windows CryptoAPI/CNG/OpenSSL identification, implementation flaw checklist, encrypted-file analysis, public-key extraction, and YARA skeleton.488- [references/languages.md](references/languages.md) — language/runtime pivots for Go, Rust (crate fingerprinting), Python bytecode (PyInstaller/PyArmor), Nim, VBS/WSH, Unity IL2CPP, and HarmonyOS HAP.489- [references/protocol-rev.md](references/protocol-rev.md) — capture-first custom protocol reversing: text vs binary framing, gRPC/protobuf decoding, WebSocket/app-frame separation, and minimal parser outputs.490- [references/browser-extension-rev.md](references/browser-extension-rev.md) — Chrome/Edge/Firefox extension workflow: MV2/MV3 entry points, permission-risk triage, content-script isolation, messaging edges, storage, and nativeMessaging.491- [references/binary-diffing.md](references/binary-diffing.md) — binary diff workflow (radiff2, Ghidra VT, BinDiff, ghidriff), FLIRT signature generation, Ghidra FID for stripped library symbol recovery, and Windows Update MSU/CAB acquisition + `PA30` delta reconstruction for n-day patch diffing.492- Exploitability handoff: once a primitive is confirmed, `offensive-techniques/binary-exploitation-technique` owns the chaining methodology and `offensive-ctf/pwn-ctf/references` holds the concrete recipes.493- [references/rootkit-and-bootkit-re.md](references/rootkit-and-bootkit-re.md) — Windows/Linux kernel-mode RE, driver/module triage, bootkit workflow, hook/callback analysis, and boot-chain evidence.494- [references/nim-rev.md](references/nim-rev.md) — Nim binary recognition, symbol recovery, GC/memory layout, decompilation patterns, stripped binary workflow.495- [references/node-v8-snapshots.md](references/node-v8-snapshots.md) — Node.js pkg/SEA/nexe extraction, V8 startup snapshot recovery, JS deobfuscation.496- [references/in-memory-loading.md](references/in-memory-loading.md) — Linux fileless loading via memfd_create + dlopen: detection, runtime dump, layer separation.497498- `offensive-tools/forensic/capa/` — capability-based binary classification (TTP/family detection).499