Lion Cipher Lab
Solve a keygen-me with angr: let symbolic execution find the serial, then see why the check can never protect a secret
- Penetration Testing / Red Team
- Advanced
- ~75 min
- Free · no account required
Why it matters
Software licence checks, 'activation' routines and hard-coded password tests are all just code that takes an input and answers yes or no. When the code is in a file the user holds, anyone can study it. A tool called a symbolic execution engine can do that study for them: instead of guessing inputs, it treats the input as an unknown, follows both outcomes of every decision, and asks a maths solver what input reaches the yes branch. As a defender you need to know this exists, to judge how much a clever-looking local check is really worth (very little), and to know the limits that make some…
What you'll learn
- explaining symbolic execution, constraints and a constraint solver in plain words
- building a small keygen-me with known source so every answer can be verified
- installing angr in a Python virtual environment
- loading a binary as an angr Project and starting from entry_state with a symbolic argv
- using claripy bitvector symbols (BVS) and adding constraints to narrow the search
- running SimulationManager.explore with find and avoid conditions and reading the stashes
- asking the solver for one answer, or several, and checking each against the real program
- recognising path explosion and the cases where angr fails (loops, hashes, crypto)
- explaining why moving the check does not help but moving the secret to a server does
Steps in this lab
- Symbolic execution in plain words
- Build the keygen-me
- Install angr in a throwaway virtual environment
- Warm up on the solver alone
- Make the serial symbolic and explore
- Never trust the solver: run the real program
- Cross-check with a plain Python copy of the check
- Where angr struggles: path explosion, loops and crypto
- The defender's takeaway: you cannot hide a check inside the thing you hand out
- Clean up
Open the full interactive lab →