Skip to main content

Overview

Cross-Origin Resource Sharing (CORS) controls which origins can access resources. Misconfigured CORS headers allow attacker’s site to read responses from victim’s authenticated session.

Key Headers


Detection

Check Headers

Look for:
If your origin is reflected back with credentials → exploitable.

Variations to Test


Vulnerable Configurations

1. Origin Reflection

Server reflects any Origin header back.

2. Null Origin Allowed

Triggered from sandboxed iframes, data URIs, local files.

3. Weak Regex

Server checks if origin contains target domain:

4. Wildcard with Credentials

Browsers block this combo, but some frameworks handle it incorrectly.

5. Pre-Domain Wildcard

If attacker has XSS on any subdomain → can exploit CORS.

Exploitation — Origin Reflection

Host on https://evil.com → victim visits → their authenticated data sent to attacker.

Exploitation — Null Origin

Sandboxed iframe sends Origin: null.

Exploitation — Subdomain Takeover + CORS

If *.TARGET.com is allowed and an unused subdomain exists:
  1. Take over unused.TARGET.com (dangling CNAME, cloud service)
  2. Host exploit on unused.TARGET.com
  3. CORS allows it → read authenticated responses

Data to Steal


Automation

Nuclei

Manual Script

Corsy


Impact Matrix


Quick Reference


Sources