Lion Cipher Lab

Exploit and fix Host header injection (password-reset poisoning and web cache poisoning) in your own lab

Why it matters

Almost every web app has to answer the question 'what is my own address?' — to build the link in a password-reset email, to set an absolute redirect, to load its own scripts and images. The lazy answer is to read it from the incoming request's HOST header, because that header names the site the browser asked for (Host: yourbank.com). The catastrophic detail is that the Host header is not trustworthy: it is just a line the CLIENT puts in the request, and a client can put anything there. An attacker sending requests by hand — with curl, a proxy, or a script — sets Host to whatever they like. So…

What you'll learn

Steps in this lab

  1. The vocabulary: the Host header is client input, not server truth
  2. Set up: confirm Node, make a folder
  3. Build the VULNERABLE app (it builds the reset link from the Host header)
  4. Exploit it (1): password-reset poisoning via the Host header
  5. Exploit it (2): the same bug via X-Forwarded-Host, and web cache poisoning
  6. Why the tempting fixes fail — feel the bypasses yourself
  7. Fix it right — a canonical base URL, an exact allowlist, and drop X-Forwarded-Host
  8. What you did — and the reflex to keep

Open the full interactive lab →