Lion Cipher Lab
Reverse an undocumented binary file format from three samples and write a safe parser for it
- Digital Forensics & IR (DFIR)
- Intermediate
- ~75 min
- Free · no account required
Why it matters
Analysts constantly meet data they have no documentation for: a log written by a vendor appliance, a cache file from an app, a config blob inside a firmware image, a custom file a program writes to disk. Being able to work out the layout from a few samples turns an opaque blob into evidence you can search, timeline and explain. The same skill is how researchers find parser bugs: a program that trusts the length fields in a file it did not write is a classic source of crashes and security flaws. In this lab you reverse a format that you generate yourself, so every answer is checkable, and you…
What you'll learn
- dumping a binary file in hexadecimal and spotting magic bytes, readable text and repeated structure
- comparing two samples to find which bytes carry a count, a timestamp or a flag
- reading little-endian integers and Unix timestamps from raw bytes with Python's struct module
- recognising a length-prefixed (type, length, value) record layout
- identifying a checksum by testing candidate algorithms against the stored value
- using a known-plaintext crib to recover a single-byte XOR key
- writing a parser that rejects malformed input cleanly and proving it with a mutation test
Steps in this lab
- The situation: an unknown file and no documentation
- Generate the samples, then hide the generator
- First look: file, strings and a hex dump
- Compare two samples to find the count and the timestamp
- Find the record layout
- Identify the trailer: guess the checksum
- Crack c.dat: a flag, a key and a known-plaintext crib
- Write the parser and write down the format note
- Try to break your own parser: truncation and lying lengths
- Check yourself against the vendor, and what a pro does differently
- Clean up
Open the full interactive lab →