Skip to content

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

FieldValue
IDCODE-0015
CategoryWeb
SeverityHIGH
CWECWE-942
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
TagsCORS, Access-Control-Allow-Origin
OWASPN/A