weirdmachine64/GhidraGPT
GhidraGPT is a Ghidra extension that sends a selected function's decompiled C to an LLM provider (OpenAI, Gemini, Ollama, etc.) and streams results back into a console, offering three actions: Explain (natural-language summary), Rewrite (recovers names/types and writes them back into the Ghidra database), and Audit (best-effort single-function review for issues like unbounded copies and integer overflows). Analysis is scoped to one function's decompiler output with no cross-function dataflow, so audit findings are leads to verify rather than sound static-analysis proof; API keys are stored locally with only XOR obfuscation, not real encryption.
What it is
GhidraGPT, a Ghidra extension (source-built, versioned as GhidraGPT-<version>.zip) that wires an LLM into the decompiler's right-click menu for three per-function actions — Explain, Rewrite (renames/types/comments written back into the program database), and Audit — with a token-streaming console and pluggable providers (API key required for all except local Ollama).
Preconditions / Affected
- Ghidra 12.1.x (the built extension declares compatibility only with the Ghidra version it is built against).
- JDK 21+ (required by Ghidra 12.x).
- Maven, plus network access to the configured provider's API — except Ollama, which runs locally with no outbound key or traffic.
What to do
Build and install from source:
git clone https://github.com/weirdmachine64/GhidraGPT.git
cd GhidraGPT
GHIDRA_INSTALL_DIR=/path/to/ghidra mvn clean packageThe zip lands in target/. In Ghidra: File → Install Extensions → +, select the zip, restart, then enable via the prompt or File → Configure → GhidraGPT → GhidraGPTPlugin. Configure a provider and model in the GhidraGPT panel; enter an API key (skip for Ollama).
For the API key: it is written to ~/.ghidragpt/config.properties, obfuscated with XOR only — this is not encryption and is not secure at-rest storage. The project's own guidance is to use a scoped, rotatable key and to protect that file with filesystem permissions. To avoid sending decompiled target code and a key off-host entirely, choose the Ollama provider, which runs locally.
Caveats
- Every action operates on a single function using only its current decompiler output; there is no interprocedural, call-graph, or whole-program context.
- Audit is a best-effort model review (unbounded copies, integer overflows, unchecked returns), not sound static analysis — treat findings as leads to verify, not proof. It will miss issues spanning multiple functions and can flag false positives.
- Rewrite mutates the program: it applies inferred names, types, prototype changes, and comments back into the Ghidra database.
Trust boundary
flowchart LR
F[Selected function<br/>decompiled C] --> P{Provider}
P -->|Ollama| L[Local, no key,<br/>no outbound traffic]
P -->|Hosted| N[Function code + API key<br/>leave host over network]
K[config.properties<br/>XOR only] -.reads.-> NChoosing a hosted provider crosses the network boundary with both your target's decompiled code and a key that is only XOR-obfuscated on disk; Ollama keeps both local.
Techniques named here
- Explain
- Rewrite
- Audit
Related in Malware & RE
Reverse Engineering the Six Stages of MacSync Stealer and RAT
Post-DEF CON Phishing Uses Malicious Google Doc to Deliver Malware
ClickFix Removes Your Background but Leaves the Malware
