Variant · Low-Medium

CWE-942: Permissive Cross-domain Security Policy with Untrusted Domains

The product uses a web-client protection mechanism such as a Content Security Policy (CSP) or cross-domain policy file, but the policy includes untrusted domains with which...

CWE-942 · Variant Level ·5 CVEs ·3 Mitigations

Description

The product uses a web-client protection mechanism such as a Content Security Policy (CSP) or cross-domain policy file, but the policy includes untrusted domains with which the web client is allowed to communicate.

If a cross-domain policy file includes domains that should not be trusted, such as when using wildcards under a high-level domain, then the application could be attacked by these untrusted domains. In many cases, the attack can be launched without the victim even being aware of it.

Potential Impact

Confidentiality, Integrity, Availability, Access Control

Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Read Application Data, Varies by Context

Demonstrative Examples

These cross-domain policy files mean to allow Flash and Silverlight applications hosted on other domains to access its data:
Flash crossdomain.xml :
Bad
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd"><allow-access-from domain="*.example.com"/><allow-access-from domain="*"/></cross-domain-policy>
Silverlight clientaccesspolicy.xml :
Bad
<?xml version="1.0" encoding="utf-8"?><access-policy><cross-domain-access><policy><allow-from http-request-headers="SOAPAction"><domain uri="*"/></allow-from><grant-to><resource path="/" include-subpaths="true"/></grant-to></policy></cross-domain-access></access-policy>
These entries are far too permissive, allowing any Flash or Silverlight application to send requests. A malicious application hosted on any other web site will be able to send requests on behalf of any user tricked into executing it.

Mitigations & Prevention

Architecture and DesignOperation

Define a restrictive Content Security Policy [REF-1486] or cross-domain policy file.

Architecture and DesignOperation

Avoid using wildcards in the CSP / cross-domain policy file. Any domain matching the wildcard expression will be implicitly trusted, and can perform two-way interaction with the target server.

Architecture and DesignOperation

For Flash, modify crossdomain.xml to use meta-policy options such as 'master-only' or 'none' to reduce the possibility of an attacker planting extraneous cross-domain policy files on a server.

Detection Methods

  • Automated Static Analysis High — Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then sea

Real-World CVE Examples

CVE IDDescription
CVE-2012-2292Product has a Silverlight cross-domain policy that does not restrict access to another application, which allows remote attackers to bypass the Same Origin Policy.
CVE-2014-2049The default Flash Cross Domain policies in a product allows remote attackers to access user files.
CVE-2007-6243Chain: Adobe Flash Player does not sufficiently restrict the interpretation and usage of cross-domain policy files, which makes it easier for remote attackers to conduct cross-domain and cross-site sc
CVE-2008-4822Chain: Adobe Flash Player and earlier does not properly interpret policy files, which allows remote attackers to bypass a non-root domain policy.
CVE-2010-3636Chain: Adobe Flash Player does not properly handle unspecified encodings during the parsing of a cross-domain policy file, which allows remote web servers to bypass intended access restrictions via un

Frequently Asked Questions

What is CWE-942?

CWE-942 (Permissive Cross-domain Security Policy with Untrusted Domains) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Variant-level weakness. The product uses a web-client protection mechanism such as a Content Security Policy (CSP) or cross-domain policy file, but the policy includes untrusted domains with which...

How can CWE-942 be exploited?

Attackers can exploit CWE-942 (Permissive Cross-domain Security Policy with Untrusted Domains) to execute unauthorized code or commands, bypass protection mechanism, read application data, varies by context. This weakness is typically introduced during the Implementation, Architecture and Design phase of software development.

How do I prevent CWE-942?

Key mitigations include: Define a restrictive Content Security Policy [REF-1486] or cross-domain policy file.

What is the severity of CWE-942?

CWE-942 is classified as a Variant-level weakness (Low-Medium abstraction). It has been observed in 5 real-world CVEs.