Lion Cipher Lab

Harden session cookies and stop session fixation

Why it matters

Almost every web app you will ever secure hands a browser a session cookie the moment you log in, and that cookie IS your identity for the rest of the visit. If the id inside it can be stolen by a script, planted before you log in, or replayed forever, the whole login was pointless. The two cheapest, highest-impact fixes in web security live here — rotate the id on login, and set three attributes on the cookie — yet they are skipped constantly. Knowing exactly what each one does, and what it does NOT do, is core identity-and-access knowledge and a very common interview topic.

What you'll learn

Steps in this lab

  1. What a session cookie is — and what this lab is (and is not)
  2. Set up Python, Flask, and the lab folder
  3. Build the VULNERABLE app and see the naked cookie
  4. What session fixation is, before you do it
  5. Exploit the fixation bug with curl
  6. Fix fixation the only reliable way: rotate the id on login
  7. Build the HARDENED app: rotation + all the cookie flags + timeouts
  8. Prove the fix: re-run the attack, then verify every flag
  9. Judgment: which control stops which threat (and what none of them do)

Open the full interactive lab →