Skip to content

Meet Ghidra

Ghidra (pronounced roughly GHEE-druh) is a software reverse engineering framework: a workbench that loads a binary, takes it apart, and gives you the tools — disassembler, decompiler, search, annotation — to understand what it does. It was developed inside the US National Security Agency over many years and released as free, open-source software (Apache 2.0) in 2019. It asks for no licence, no account, and no payment, and it runs on Windows, macOS, and Linux.

The workbench has three engines and a container. Everything in this guide hangs on these four pieces.

The loader and the language. A binary is not self-describing: the same bytes mean different instructions on different processors. So importing a program is two decisions. The loader works out the file's format — an ELF from Linux, a PE from Windows, a raw blob of firmware with no format at all. The language then says which processor the code is for and how its instructions are spelled, described in files written in Ghidra's processor-description language, SLEIGH. The 12.2 tree on the build machine carries modules for 39 processor families — x86 and ARM and MIPS, but also the 6502 and Z80 of older machines — each with its endianness and width variants. Most of the time the loader's guess is right and you never think about either decision; the firmware chapter is about the times it isn't.

The disassembler. Given the language, the disassembler walks the bytes and translates them into assembly instructions, following jumps and calls to find code that a simple linear sweep would miss. Its results fill the Listing, the central pane of the main window: address by address, the program as the processor will execute it.

The decompiler. The decompiler takes the disassembler's work and reconstructs C-like code for each function. It is an interpreter of behaviour, not a recovery of the original text: variable names become param_1 and iVar1, types are guessed, and a shift may come back as a multiplication. Chapter 6 is about reading it with those habits in mind.

The project. Your work — the imported programs, the analysis results, the names and comments you add — lives in a project, Ghidra's own container, separate from the binary you imported. Two consequences matter:

  • The original file is never modified. Import copies the binary into the project; everything you do happens to the copy. (On the build machine the specimen's file kept its original timestamp through every analysis in this guide.)
  • Analysis is an asset. The expensive work — finding functions, naming strings, resolving references — is done once by auto-analysis, a battery of small specialist passes called analysers, and saved in the project. Reopening a program is instant; re-analysing is a choice, not a toll.

There are two front doors to the same workbench. The CodeBrowser is the graphical window — Listing in the middle, decompiler beside it, trees and tables around — where interactive reading happens. analyzeHeadless is the same engines with no window at all, driven from a command line, for batches and repeatability; chapter 10 runs it for real. Nothing about the analysis differs between them, which is why this guide can prove in a terminal what it teaches for the window.

Check: the frame to keep — loader and language get the bytes understood, the disassembler makes the Listing, the decompiler makes the C, and the project keeps all of it, safely away from your original file.