Reverse engineering binaries with ghidra

From meltedinhex/analyst-ai-pack · View interactive version

Reverse engineering binaries with ghidra is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Uses Ghidra to disassemble and decompile a binary, navigate to key routines via imports and strings, annotate decompiled code, and run headless scripts to automate extraction of C2, crypto, and config. Activates for requests to reverse engineer with Ghidra, decompile a binary, or script Ghidra headl

How to use this skill

Skill file

Reverse Engineering Binaries with Ghidra

When to Use

automate extraction across many samples via headless scripts.

Do not use Ghidra as a first step for unknown samples — triage statically and behaviorally

first, and unpack before decompiling a packed binary.

Prerequisites

Safety & Handling

Workflow

Step 1: Import and auto-analyze

Create a project, import the binary (Ghidra detects PE/ELF/Mach-O and arch), and run

auto-analysis with default analyzers.

Step 2: Navigate to interesting code

Start from imports (Symbol Tree) and strings (Defined Strings). Cross-reference (X) from a

suspicious API or string to its callers to reach the relevant function quickly.

VirtualAlloc/WriteProcessMemory -> injection logic
InternetOpen/WinHttp*           -> C2
CryptEncrypt / custom XOR loops -> crypto/config decode

Step 3: Annotate the decompiler output

Retype variables, rename functions, and add comments as you understand the code. Good naming

turns the decompiler into readable pseudo-C and compounds across a session.

Step 4: Automate with headless scripts

For repeatable extraction, run Ghidra headless with a post-script. The bundled Python uses

analyzeHeadless to export functions/strings to JSON:

python scripts/analyst.py headless --ghidra /opt/ghidra --bin sample.bin --out out.json

Step 5: Extract the target artifact

Recover the C2 string, key, or config and validate it against dynamic observations.

Validation

Pitfalls

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.