Lion Cipher Lab

Recover a struct in Ghidra: turn raw offsets into named fields and retype a function

Why it matters

Real programs are made of structures: a network packet, a config record, a process entry, a malware task block. Compilers erase the names of the fields, so in a stripped binary all you see is a pointer and a pile of plus-number arithmetic. Until you rebuild the structure you are reading arithmetic, not meaning, and every analysis after that (what does this code store, what does it send, where is the length check) is slow and error-prone. Recovering structs is the step that turns a decompiler listing into something you can explain to a colleague. It also teaches the fact behind many memory…

What you'll learn

Steps in this lab

  1. The vocabulary, in plain words
  2. Write the program, work out its layout on paper, then build it stripped
  3. Import it into Ghidra and find the three functions
  4. See the problem: pointer plus a number
  5. Let Ghidra draft the structure, then see why it is incomplete
  6. Finish the structure by hand and name the fields
  7. Retype every function and watch the arithmetic disappear
  8. Test your understanding: change the layout, recompile, re-read
  9. When NOT to do this by hand, and how a pro does it better

Open the full interactive lab →

Keep learning