Ghidra

947 Words · 4 Minutes, 18 Seconds

Ghidra: Reading a Binary Like Source Code

Ghidra is the free, open-source reverse-engineering suite released by the NSA. Its headline feature is a genuinely excellent decompiler that turns compiled machine code back into readable C-like pseudocode — for most challenges it’s the difference between squinting at assembly for an hour and reading the logic in five minutes. It’s the tool I reach for first on any reversing binary, and it’s what cracked Go Go Decompile in the Brunner 2026 set.

Installation

Ghidra is a Java application, so you need a JDK (21+ for recent releases).

unzip ghidra_*.zip
cd ghidra_*/
./ghidraRun          # ghidraRun.bat on Windows

The basic workflow

1. Create a project and import the binary

Ghidra organises work into projects. On first launch:

  1. File → New Project → Non-Shared Project, pick a folder and a name.
  2. Drag your binary into the project window (or File → Import File). Ghidra auto-detects the format (ELF, PE, Mach-O, raw).
  3. Double-click the imported file to open it in the CodeBrowser.

2. Let auto-analysis run

When you open a binary, Ghidra offers to analyze it — say Yes and accept the defaults for a first pass. Auto-analysis disassembles the code, identifies functions, resolves cross-references, and recovers strings. On a small CTF binary this takes seconds.

3. Navigate

The windows you’ll live in:

4. Follow the logic

Double-click a function to decompile it. Then:

Extracting data tables from .rodata

A recurring reversing pattern — and exactly what Go Go Decompile and KPwhy came down to — is that the interesting data (an encoded flag, a lookup table, a set of constants) sits in .rodata, and the code just indexes into it. In Ghidra:

  1. Find the reference in the decompiler (e.g. puts(&DAT_004c8f20) or an array base address).
  2. Double-click the address to jump to it in the Listing.
  3. Select the bytes and Right-click → Copy Special → Byte String to pull them out, or note the virtual address and carve them from the file directly.

For scripted extraction you often want the file offset rather than the virtual address. Ghidra shows both, but you can also compute it once you know the section layout (readelf -S ./bin gives the vaddr→file-offset delta for .rodata), then read the bytes in Python for further processing:

with open('bin', 'rb') as f:
    f.seek(FILE_OFFSET)
    table = f.read(LENGTH)
import base64
print(base64.b64decode(table))   # e.g. Go Go Decompile stashed a base64 blob here

Go binaries: a word of warning

Go Go Decompile was a Go binary, and Go is deliberately awkward to reverse:

Ghidra ships with Go analysis improvements in recent versions, but pairing it with nm/objdump remains the fastest way in.

Handy extras

Best practices

Conclusion

Ghidra flattens the learning curve of reverse engineering more than any other free tool. You won’t understand every binary at a glance, but between the decompiler, cross-references, and a bit of renaming discipline, you’ll turn most CTF reversing challenges from an assembly slog into a reading exercise. Import the binary, hit analyze, and start renaming. Happy reversing!


ghidrareverse-engineeringdecompilerstatic-analysis

Reversing