CORS Misconfiguration Lab

An account API reflects any Origin and allows credentials. Read a victim's private data from another site, then switch on an exact allowlist.

An account API copies whatever Origin arrives into Access-Control-Allow-Origin and allows credentials. That one shortcut lets any website a logged-in user visits read their private data with their own cookies.

How to use it

  1. Request the API from its own origin.
  2. Change the Origin to a site you control.
  3. Switch the server to an exact allowlist and repeat.

What to take away

CORS relaxes a protection

The same-origin policy stops other sites reading responses. CORS headers tell the browser when to relax it, so a too-generous header removes the protection entirely.

Credentials make it serious

A reflected origin without credentials leaks only public data. With Access-Control-Allow-Credentials: true, the attacker reads whatever the victim's session can see.

Beware the null origin

Sandboxed iframes and some redirects send Origin: null. Allowing "null" is as bad as allowing everyone, because any attacker page can produce it.

Frequently asked questions

How should CORS be configured?

Compare the Origin against an exact list of full origins you own, and only then echo it back with Vary: Origin. Never use suffix, prefix or loose regex matching, and never allow null.

Does CORS stop the request from being sent?

No. The browser still sends simple requests; CORS controls whether the calling page may read the response. Use CSRF defences for state-changing actions.

Where this fits in the course

This security lab pairs with Path 11 — Web Security — see all 26 learning paths.

It runs entirely in your browser: nothing is uploaded, no account is needed, and it is free.

Related

  • CSRF Playground — A "bank" transfer endpoint trusts your cookie alone. Watch a malicious page forge a request on your behalf, then see a CSRF token stop it cold.
  • SSRF Playground — A "fetch this URL for me" feature with no allowlist. Point it at internal-looking addresses and see what it leaks.
  • Security Header Analyzer — Paste HTTP response headers and get a graded report on the security headers present and missing.
  • BOLA/BFLA Playground — A fake employee-directory API. Read a record that isn't yours, then call an admin-only action with no admin role at all.

Browse all 50 security labs →