Ghidra for Mere Mortals
Most programs arrive in your life as finished binaries: no source code, no comments, no names — just machine code that a computer can run and a human seemingly cannot read. Reverse engineering is the craft of reading such a program anyway, and Ghidra is the workbench for it: a disassembler that turns machine code back into assembly you can follow, and a decompiler that goes one step further and rebuilds something that looks like C. It was built by the US National Security Agency, released to the public in 2019, and it is free and open source.
This guide teaches the workbench on a specimen
you can hold in your hand: a 16-kilobyte toy
program, gatekeeper, that asks for a numeric
code and opens a gate for exactly one of them.
The code is never stored in the program. You
will watch Ghidra take the program apart, read
the lock's mechanism out of the decompiled
code, work out the code — 4213 — and prove it
by running the program. Everything after that
is the same craft at larger scale: symbols and
renaming, searching, notes that survive the
session, headless analysis that runs without
the window, small scripts, and a survey of
firmware and other processors.
A note on how this guide was verified.
Ghidra 12.2 was downloaded for real on the
build machine, its checksum matched against
the hash in the official release notes, and
its headless analyser was run against the
specimen: the function list, the planted
strings, and every decompiled body quoted in
these chapters are real output, kept in
examples/. The specimen's stripped twin was
analysed the same way, and eight headerless
bytes of ARM64 were imported raw and read.
The graphical window — the CodeBrowser — could
not be driven in the build sandbox, which has
no display, so the chapters that walk its
panels are marked (documented) and follow
Ghidra's own manuals; the work those panels
present is the same work the headless runs
prove. criteria.md keeps the exact ledger.
What this guide covers
- What reverse engineering is — reading a program you don't have the source for, what it's legitimately for, and the safety and legal lines stated plainly
- Meet Ghidra — the loader, the disassembler, the decompiler, and the project that holds your work
- Installing Ghidra — the JDK it needs first, the download, the checksum, and why there is no installer
- Your First Project — making a project, importing a binary, and what auto-analysis does before you read a single instruction (documented)
- Reading the listing — the specimen, its instructions address by address, and finding the lines that decide
- The decompiler — the same functions as C, the mechanism read out loud, and the gate code solved and proven
- Symbols and functions — where names come from, what stripping takes away, and renaming and retyping as you learn
- Bookmarks and comments — marking the trail so a session's discoveries survive it (documented)
- Searching — strings, references, and program text: finding the one place in ten thousand that matters
- Headless analysis — the whole analysis with no window at all, run for real, and the two traps it caught this guide in
- Scripting in miniature — one small script that surveys a program, and the name collision that renamed it
- Firmware and other architectures — raw bytes, other processors, and eight bytes of ARM64 read for real
- The neighbours — objdump and friends for quick looks, radare2 and rizin, Binary Ninja, IDA, and when each is the right tool
- What Ghidra can't do — the honest limits: decompiled is not source, packed code, and analyses that can be wrong
- Troubleshooting —
the wrong JDK, scripts that aren't found,
seas of
FUN_, and code that won't appear - Glossary — the terms, collected in one place
What it doesn't cover
Running programs under Ghidra's debugger (a real feature, and a different discipline — this guide is about reading, not running), exploit development, defeating licences or copy protection, and anything about software that isn't yours to examine. It also doesn't teach assembly language as a subject: it teaches you to read the small amount this one specimen needs, and says where to go to learn more.
How to use this guide
Read the first two chapters away from the
keyboard; they are the mental model. Then
install Ghidra, and work the specimen in
examples/ alongside chapters 5 and 6 —
the source is there, the compiled binary is
there, and so are the transcripts of what
Ghidra said about it, so you can check your
screen against real output at every step.
Only after the specimen makes sense should
you point the tool at anything bigger.