Insecure 'Access-Control-Allow-Origin' Header

low Web Application Scanning Plugin ID 98057

Synopsis

Insecure 'Access-Control-Allow-Origin' Header

Description

Cross Origin Resource Sharing (CORS) is an HTML5 technology which gives modern web browsers the ability to bypass restrictions implemented by the Same Origin Policy.

The Same Origin Policy requires that both the JavaScript and the page are loaded from the same domain in order to allow JavaScript to interact with the page. This in turn prevents malicious JavaScript being executed when loaded from external domains.

The CORS policy allows the application to specify exceptions to the protections implemented by the browser, and enables the developer to specify allowlisted domains for which external JavaScript is permitted to execute and interact with the page.

The 'Access-Control-Allow-Origin' header is insecure when set to '*' or null, as it allows any domain to perform cross-domain requests and read responses. An attacker could abuse this configuration to retrieve private content from an application which does not use standard authentication mechanisms (for example, an Intranet allowing access from the internal network only).

Solution

Unless the target application is specifically designed to serve public content to any domain, the 'Access-Control-Allow-Origin' should be configured with an allowlist including only known and trusted domains to perform cross-domain requests if needed, or should be disabled.

See Also

https://www.owasp.org/index.php/CORS_OriginHeaderScrutiny

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

Plugin Details

Severity: Low

ID: 98057

Type: remote

Published: 3/31/2017

Updated: 12/3/2020

Scan Template: api, scan, pci, overview, config_audit

Risk Information

Risk Factor: Low

CVSS v2.0

Base Score: 2.6

Vector: AV:N/AC:H/Au:N/C:P/I:N/A:N

CVSS v3.0

Base Score: 3.1

Vector: CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N

Reference Information