Skip to main content
skill CX Codex

reverse-engineering · mohitmishra786 — Claude Code skill: binary analysis

A skill that walks the agent through binary analysis: Ghidra decompilation, radare2 workflows, Binary Ninja scripting. Useful when there is no source and you need the logic back.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mohitmishra786/low-level-dev-skills --skill reverse-engineering -a claude-code
Open on GitHub

What reverse-engineering does

The skill lays out a reverse engineering workflow. First triage with file, strings, xxd, readelf and checksec, then disassembly and decompilation. Separate sections cover headless Ghidra analysis, Java and Jython scripts for it, radare2 command mode, and the Binary Ninja Python API.

There is a block on C++ patterns: vtables, RAII, templates, std::string layout. Then symbol recovery in stripped binaries and version diffing with Diaphora or BinDiff. A troubleshooting table closes it out — why the Ghidra decompiler chokes on indirect jumps, what to do when r2 analysis comes back incomplete, how to get past a ptrace check.

The skill installs nothing on its own. Ghidra, radare2, Binary Ninja and checksec have to be on the machine before you hand the agent a binary, or it will keep pointing at tools that are not there.

What it helps with

  • analyze an unknown binary with no source
  • recover algorithm logic from a compiled executable
  • compare two firmware builds and find patched functions
  • recover symbols from a stripped ELF or PE
  • script Ghidra or r2 instead of clicking through the GUI

Example prompts for the agent

  • triage this ELF with file and strings, then load it into Ghidra
  • walk me through finding main in a stripped binary via __libc_start_main
  • diff firmware_v1 and firmware_v2 and list the changed functions

How to install reverse-engineering

1Skills CLI (Vercel)

npx skills add mohitmishra786/low-level-dev-skills --skill reverse-engineering -a claude-code

2Manually: put the files in place

~/.claude/skills/reverse-engineering/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/reverse-engineering/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about reverse-engineering

How do I install reverse-engineering in Claude?

Run npx skills add mohitmishra786/low-level-dev-skills --skill reverse-engineering -a claude-code. The skill lands at ~/.claude/skills/reverse-engineering/SKILL.md.

What does reverse-engineering do?

It guides the agent through binary analysis: triage, Ghidra decompilation, radare2 sessions, Binary Ninja scripting, C++ pattern recognition, symbol recovery and binary diffing.

What tools does the skill need?

Ghidra, radare2, Binary Ninja, Diaphora or BinDiff, plus utilities like strings, readelf and checksec. The skill only describes the process; you install those yourself.

Source text

SKILL.md · MIT
---
name: reverse-engineering
description: Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.
---

# Reverse Engineering

## Purpose

Guide agents through reverse engineering binaries: Ghidra project setup and decompilation, radare2 analysis workflow, Binary Ninja scripting, initial triage with `strings`/`file`/`xxd`, identifying C++ patterns (vtables, RAII), analyzing stripped binaries, and diffing with Diaphora or BinDiff.

## When to Use

- Analyzing an unknown binary without source code
- Recovering algorithm logic from compiled executables
- Comparing two firmware versions for vulnerability patches
- Understanding malware or CTF challenge binaries
- Recovering symbols from stripped ELF/PE files
- Automating analysis with Ghidra or r2 scripts

## Workflow

### 1. Initial triage

```bash
file suspicious_binary
strings -n 8 suspicious_binary | head -50
strings -el suspicious_binary          # UTF-16 LE
xxd suspicious_binary | head -20
readelf -h suspicious_binary           # ELF
objdump -d -M intel suspicious_binary | head -40

# Check protections
checksec --file=suspicious_binary
```

| Command | Reveals |
|---------|---------|
| `file` | Architecture, static/dynamic, stripped |
| `strings` | URLs, paths, error messages, keys |
| `readelf -s` | Symbol table (if not stripped) |
| `nm -D` | Dynamic symbols |
| `checksec` | RELRO, NX, PIE, canary |

### 2. Ghidra workflow

```bash
# Headless analysis
analyzeHeadless /tmp/ghidra_projects MyProject \
  -import suspicious_binary \
  -postScript ExportDecompile.java

# GUI: File → New Project → Import File → Analyze (Yes)
```

Key steps:
1. **Auto-analysis** — let Ghidra complete disassembly
2. **Define functions** — `F` at entry points if missed
3. **Decompiler** — Window → Decompiler (C-like output)
4. **Rename** — `L` on variables/functions for clarity
5. **Cross-references** — `Ctrl+Shift+F` on function/data

```java
// Ghidra script (Java) — list functions > 100 bytes
import ghidra.program.model.listing.*;

FunctionManager fm = currentProgram.getFunctionManager();
for (Function f : fm.getFunctions(true)) {
    if (f.getBody().getNumAddresses() > 100)
        println(f.getName() + " @ " + f.getEntryPoint());
}
```

```python
# Ghidra Python (Jython)
from ghidra.program.model.listing import FunctionManager
fm = currentProgram.getFunctionManager()
for f in fm.getFunctions(True):
    print(f.getName(), f.getEntryPoint())
```

### 3. radare2 workflow

```bash
r2 suspicious_binary
```

```
[0x00001000]> aaa          # analyze all
[0x00001000]> afl          # list functions
[0x00001000]> pdf @ main   # disassemble function
[0x00001000]> VV           # visual graph mode
[0x00001000]> iz           # strings in data sections
[0x00001000]> s sym.main; pdf
```

Patching:

```
[0x00001000]> wx 9090 @ 0x401234   # write NOPs
[0x00001000]> wci 0x401234         # insert instruction
[0x00001000]> wt modified_binary
```

```bash
# r2 scripting
r2 -qc 'aaa; afl' suspicious_binary
r2 -i analysis.r2 suspicious_binary
```

### 4. Binary Ninja scripting

```python
# BN Python API
import binaryninja as bn

bv = bn.load("suspicious_binary")
for func in bv.functions:
    if func.name.startswith("sub_"):
        hlil = func.hlil
        for block in hlil:
            print(block)
```

### 5. C++ pattern recognition

```cpp
// Vtable pattern in disassembly
// mov rax, [rdi]      ; load vtable pointer
// call [rax+0x10]     ; virtual call at offset

// Constructor pattern
// mov [obj], offset vtable
```

| Pattern | Indicator |
|---------|-----------|
| Vtable | `.data.rel.ro` section, array of function pointers |
| RAII | paired ctor/dtor calls, exception landing pads |
| Templates | Mangled names `_Z...`, duplicate logic per type |
| std::string | SSO buffer inline or heap pointer at offset 0 |

```bash
# Demangle C++ symbols
c++filt _ZN4Math3addEii
```

### 6. Stripped binary recovery

```bash
# Find main via __libc_start_main
readelf -s binary | grep -E 'main|start'
# Or r2: afl~entry

# FLIRT signatures (Ghidra/BN) — match libc patterns
# Stack string analysis in Ghidra decompiler
```

Strategies:
- Identify `main` via libc init or entry point
- Find syscalls (`syscall` insn on Linux)
- String xref to locate error handlers
- Entropy analysis for encrypted sections

### 7. Binary diffing

```bash
# Diaphora (Ghidra/IDA plugin)
# Export from both binaries, run diff

# BinDiff (commercial, IDA/Ghidra)
bindiff old.i64 new.i64

# Simple hash diff
sha256sum firmware_v1 firmware_v2
diff <(objdump -d v1) <(objdump -d v2) | head
```

Use diffing to find patched vulnerability functions after updates.

### 8. RE decision tree

```
Binary type?
├── ELF/Linux → Ghidra + r2 + readelf
├── PE/Windows → Ghidra + PE-bear + x64dbg reference
├── Firmware → binwalk extract → Ghidra on architecture
└── Obfuscated → dynamic analysis (gdb/ltrace) first
```

## Common Problems

| Symptom | Cause | Fix |
|---------|-------|-----|
| Ghidra decompiler fails | Indirect jumps, bad types | Fix function signature; define struct |
| r2 analysis incomplete | Large binary | `aaa` then `aac` ; increase analysis depth |
| Wrong architecture | ARM vs Thumb, MIPS | Set `-a arm` or correct Ghidra language |
| Anti-debug trap | ptrace check | Patch or use `-gdb` in QEMU |
| Packed binary | UPX/etc. | `upx -d` or manual unpack |
| No xrefs to string | PIE/RELRO | Follow GOT; runtime analysis |

## Related Skills

- `skills/binaries/elf-inspection` — ELF structure analysis
- `skills/debuggers/gdb` — dynamic analysis complement
- `skills/runtimes/binary-hardening` — understanding mitigations being bypassed
- `skills/security/kernel-security` — kernel RE and CVE analysis
- `skills/low-level-programming/assembly-x86` — reading disassembly
- `skills/low-level-programming/assembly-arm` — ARM binary analysis

© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills

Similar skills

Everything for Security →

reverse-engineering by other authors comes first.

reverse-engineering zhaoxuya520 Guides code agents through static and dynamic analysis of binaries, bytecode, and firmware. Useful when dissecting obfuscated logic before exploitation. CX Codex +1 1,800installs reverse-engineering rehan-remade Lets the agent read a game from the inside: decompiled code, dumped asset formats, live memory. Useful when a mod needs an exact function address or the layout of a file. CX Codex +1 1,600installs reverse-engineer sickn33 Structured reverse engineering workflow for binaries: static decompilation, dynamic tracing, pattern detection, and automation scripts. CX Codex +1 892installs ctf-reverse ljagiello A reverse engineering reference for CTF challenges: guides coding agents through binary inspection, anti-debug bypass, and virtual machine analysis. CX Codex +1 10,100installs reverse-engineering-tools gmh5225 A skill for pulling apart game binaries, drivers and dumps: disassembly, decompilation, debugging and interface reconstruction. CX Codex +1 544installs learn-reverse-engineering rohitg00 Interactive tutor for reading compiled programs. One lesson per invocation: from file formats and disassembly to symbolic execution and AI-assisted analysis. Requires Python 3.10+ and your own source code. CX Codex +1 488installs ghidra-headless trailofbits This skill drives Ghidra's headless analyzer to pull functions, strings, symbols and call graphs out of a binary. Useful when there is no source to read. CX Codex +1 507installs code-obfuscation-deobfuscation yaklang Binary deobfuscation playbook covering junk code, opaque predicates, control flow flattening, self-modifying code, and virtual machine protectors. CX Codex +1 4,000installs

From the same set62

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor