Lion Cipher Lab

Exploit and fix a CORS misconfiguration (in your own lab)

Why it matters

CORS misconfiguration is one of the most common and most misunderstood web bugs, because the mechanism is subtle: browsers, by default, let a page on one site SEND a request to another site but BLOCK the page from READING the response — that default is the Same-Origin Policy, and it is what stops evil.example from silently reading your webmail. CORS (Cross-Origin Resource Sharing) is the controlled way a server relaxes that rule, by returning an Access-Control-Allow-Origin header that names which origins are allowed to read its responses. The dangerous mistake is to REFLECT whatever Origin…

What you'll learn

Steps in this lab

  1. The vocabulary: origin, Same-Origin Policy, and what CORS actually does
  2. Set up: confirm Python, make a folder, install Flask
  3. Build the VULNERABLE API (it reflects any Origin, with credentials)
  4. Prove the misconfiguration (watch your untrusted Origin come back)
  5. Why reflecting the Origin (or regex-matching it) is the wrong fix
  6. Fix it: an exact allowlist, no reflection, no '*'+credentials, add Vary
  7. What you did — and the reflex to keep

Open the full interactive lab →