How to fix: Dangerous CORS Configuration
The server allows credentials with a wildcard origin, a self-defeating combination that no compliant browser will actually honor.
Why it matters
Per the Fetch/CORS spec, browsers compare a credentialed request's Access-Control-Allow-Origin against the request's exact origin string; a literal '*' never matches, so standards-compliant browsers block the response from being read. The practical exposure is limited to non-compliant or non-browser HTTP clients, not the 'any website can steal authenticated data' scenario this configuration suggests.
This combination is inert in every modern browser, but it signals a careless or confused CORS setup. If the server is later changed to reflect the request's Origin instead of a literal wildcard (see cors-origin-reflection), the same code becomes genuinely exploitable.
How to fix it
- 1Never combine wildcard with Allow-Credentials: true.
- 2Explicitly list allowed origins.
- 3Validate the Origin header against an allowlist.
Code examples
Secure CORS
const ALLOWED = ['https://yourdomain.com'];
if (ALLOWED.includes(origin)) {
res.setHeader('Access-Control-Allow-Origin', origin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
}References
Detected automatically by VulnRadar. The check id is cors-credentials-wildcard, stable across every scan so you can filter or diff on it.
More headers checks
- HighMissing HTTP Strict Transport Security (HSTS)
- HighMissing Content Security Policy (CSP)
- MediumMissing Clickjacking Protection
- LowMissing Referrer-Policy Header
- LowMissing Permissions-Policy Header
- MediumWildcard CORS Policy
- LowMissing X-XSS-Protection Header
- InfoMissing Cross-Origin-Resource-Policy (CORP)
Questions
- How severe is Dangerous CORS Configuration?
- VulnRadar rates this medium severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id cors-credentials-wildcard, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Dangerous CORS Configuration map to?
- It maps to CWE-942. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.