Skip to content

Ghidra for binary analysis

Use Ghidra to narrow the search and explain the program’s paths. Use a debugger to confirm what happened at runtime.

Simplified Ghidra CodeBrowser layoutA schematic view of the CodeBrowser with a symbol tree on the left, assembly listing in the center, decompiler view at the right, and function graph beneath the listing.CodeBrowserschematic viewSymbol Tree▾ Functionsmainread_inputcheck_value▾ Importsputsread▾ Strings"Enter value:"Listing0040123055push rbp0040123148 89 e5mov rbp, rsp0040123448 83 ec 20sub rsp, 0x200040123848 8d 3d ..lea rdi, [prompt]0040123fe8 .. .. ..call puts00401244e8 .. .. ..call read_inputDecompilerint main(void) {puts(prompt);read_input(buf);if (check_value(buf))return 1;}Function Graphinput + checksuccessfailure
  1. Create a project and import the supplied executable.
  2. Check the detected format, processor, and endianness.
  3. Run auto-analysis with the suggested analyzers and wait for it to finish.
  4. Open the CodeBrowser. Keep the Program Tree, Symbol Tree, Listing, and Decompiler available.
  5. Start at the entry point and locate main or the function that owns the user-visible loop.

Look at strings, imports, and references first. A prompt string may lead to the function that reads input. An imported API such as read, fgets, scanf, or printf may lead to a relevant caller.

  • Use Search to find strings and function names.
  • Use References To on a string or function to find callers.
  • Follow the call sites to see how values reach a function.
  • Use the Function Graph to inspect branches and loops.

Rename functions by observed behavior, such as read_name or check_password. Rename variables when their purpose is clear, then add a short comment with the evidence.

View Use it to
Decompiler Follow likely control flow and data flow in a function.
Listing Check instructions, addresses, and branch behavior.
References / XRefs Find code that uses a string, function, global, or address.
Function Graph See branches and merge points in a selected function.
Bytes / Data view Inspect raw bytes, constants, tables, or encoded data.
Symbol Tree Navigate functions, labels, imports, and external names.

Use strings, imported functions, entry points, and call structure as navigation anchors. Auto-analysis can miss or misclassify code, so inspect the function boundary when something looks wrong. Label small confirmed behaviors and compare them with a debugger run.

The official Ghidra beginner guide covers projects, analysis, symbols, references, the decompiler, and function graphs.