Lion Cipher Lab

Build an SSRF-safe URL fetcher that survives the bypass zoo (from scratch)

Why it matters

Server-Side Request Forgery (SSRF) is the bug behind some of the largest cloud breaches, and it hides in the most innocent-looking feature: anything that 'fetches a URL for the user' — a link-preview generator, a webhook, an image proxy, a PDF renderer, an import-from-URL button. That feature quietly hands an attacker your server's network position, letting them reach internal admin panels, databases, and — the crown jewel — the cloud metadata endpoint (169.254.169.254) that on many instances hands out temporary IAM credentials to anything that asks. The Capital One 2019 breach was exactly…

What you'll learn

Steps in this lab

  1. What SSRF is, and the sink you are about to build a safe version of
  2. Stand up the lab: an internal secret, a fake metadata endpoint, and a naive fetcher
  3. The bypass zoo: every way one internal address hides
  4. Layer 1 — scheme allowlist and reject credentials in the URL
  5. Layer 2 — resolve-then-pin: validate every resolved IP, then connect to the PINNED one
  6. Layer 3 — re-validate every redirect hop (never trust the Location header)
  7. The hardest bypass: DNS rebinding / TOCTOU, and why validate-at-connect wins
  8. Layer 4 + scoreboard: egress allowlist, then fire the whole zoo at both fetchers
  9. The judgment: allowlist-not-denylist, validate-at-connect, and the production do-it-better

Open the full interactive lab →