Classification
- CWE-942 Permissive Cross-domain Policy with Untrusted Domains (related: CWE-346 Origin Validation Error).
- OWASP Top 10 2021: A05 Security Misconfiguration.
- OWASP API Security Top 10 2023: API8 Security Misconfiguration.
Common misconfigurations
- Reflecting any Origin header back in Access-Control-Allow-Origin with credentials allowed.
- Regular-expression or suffix checks that accept example.com.attacker.net or attackerexample.com.
- Allowing the null origin, which sandboxed iframes and local files can send.
- Trusting every subdomain, so one XSS or takeover on any subdomain exposes the API.
- Allowing plain-HTTP origins for an HTTPS API.
How it is found and proven
Send authenticated requests with different Origin headers (an unrelated domain, a look-alike suffix, null, an http:// variant) and inspect Access-Control-Allow-Origin and Access-Control-Allow-Credentials in the response. That shows the policy. Proof of impact is a page on an untrusted origin that, opened by a logged-in test user, reads a sensitive response with fetch and credentials included. A wildcard (*) without credentials on public data is not a vulnerability.
Remediation
Use an explicit allow-list of exact origins and compare whole strings. Do not reflect the request Origin. Never allow null. Only enable credentials for origins that need them, and do not expose authenticated endpoints to CORS at all if no browser client on another origin needs them. Send Vary: Origin when the header varies.
What Pentest-Swarm covers for CORS
Pentest-Swarm does not currently test CORS misconfiguration automatically. Its verification oracles have no CORS producer today; the project lists header-aware CORS as a candidate for future oracle work.
- It does test the authenticated APIs that a CORS flaw would expose, for BOLA, mass assignment and authentication bypass.
- nuclei, which is in the arsenal, has community templates for some CORS patterns, but those results are not oracle-verified.
- Subdomain enumeration during recon helps you see how many origins a wildcard-subdomain policy would trust.
Where it falls short
CORS is quick to check by hand or with an intercepting proxy, and simple to review in configuration. Use Burp Suite or a short script to vary Origin across authenticated endpoints, and confirm impact with a browser-based proof of concept before rating severity.
Questions
Is Access-Control-Allow-Origin: * a vulnerability?
Not by itself. Browsers refuse to send credentials to a wildcard, so it only matters if the response is sensitive without authentication.
Does CORS protect against CSRF?
No. CORS controls whether a page can read responses; many cross-site requests are still sent. Use CSRF defences separately.
Why is the null origin dangerous?
Any attacker can produce a request with Origin: null from a sandboxed iframe, so allowing it is close to allowing everyone.