Lion Cipher Lab

Harden an HTTP layer against response splitting (CRLF injection)

Why it matters

Response splitting is what happens when a server lets attacker-controlled text flow into the bytes of an HTTP response without neutralising the CR and LF characters that structure that response. Because CR+LF (\r\n) is the exact delimiter HTTP uses to separate one header from the next, and a doubled CR+LF ends the header block, a single reflected redirect URL like ?url=/next%0d%0a%0d%0aHTTP/1.1... can inject a forged header or splice an entire second response into the stream — poisoning a shared cache, planting a cookie, or delivering script to every later visitor. It is CWE-113, and it keeps…

What you'll learn

Steps in this lab

  1. What response splitting is — and the ground rules
  2. How a header gets poisoned: reflection + CRLF
  3. Set up: a terminal, Python, and a scratch folder
  4. Build the naive serializer AND an on-the-wire measurer
  5. Run it and MEASURE the naive damage
  6. The fix, proven: allowlist the header grammar
  7. Failure mode 1: the decode-order bug
  8. Failure mode 2, the right layer, and 'why this, not that'
  9. What you proved — and the defender's checklist

Open the full interactive lab →