Permissive Cross-domain Policy with Untrusted Domains
Description
The application sets the Access-Control-Allow-Origin header to a permissive value, allowing any domain to access the application's resources. This could lead to spoofing, data theft, relay, and other attacks.
Examples
Insecure Code
scala
response.setHeader("Access-Control-Allow-Origin", "*");Secure Code
scala
response.setHeader("Access-Control-Allow-Origin", "https://example.com");Remediation
Set the Access-Control-Allow-Origin header to a specific domain or a list of trusted domains instead of using a wildcard or null value.
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0015 |
| Category | Web |
| Severity | HIGH |
| CWE | CWE-942 |
| Confidence | HIGH |
| Impact | HIGH |
| Likelihood | MEDIUM |
| Exploitability | EASY |
| Tags | CORS, Access-Control-Allow-Origin |
| OWASP | N/A |