CWE-942 Variante Incompleto

Permissive Cross-domain Security Policy with Untrusted Domains

This vulnerability occurs when a web application's cross-domain security policy, like a Content Security Policy (CSP), explicitly allows communication with untrusted or overly permissive external…

Definición

What is CWE-942?

This vulnerability occurs when a web application's cross-domain security policy, like a Content Security Policy (CSP), explicitly allows communication with untrusted or overly permissive external domains.
A permissive cross-domain policy undermines a key web security control. By listing untrusted domains or using overly broad wildcards (e.g., *.example.com), you grant those external sites the ability to interact with your application's data and user session, effectively inviting potential attackers into a trusted context. Attackers hosted on these permitted domains can often launch exploits, such as data theft or session hijacking, without any visible warning to the end user. This makes the vulnerability particularly dangerous, as a compromise can occur silently during normal browsing, bypassing the intended protections of the security policy.
Impacto en el mundo real

Real-world CVEs caused by CWE-942

  • Product has a Silverlight cross-domain policy that does not restrict access to another application, which allows remote attackers to bypass the Same Origin Policy.

  • The default Flash Cross Domain policies in a product allows remote attackers to access user files.

  • Chain: 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 scripting (XSS) attacks.

  • Chain: Adobe Flash Player and earlier does not properly interpret policy files, which allows remote attackers to bypass a non-root domain policy.

  • Chain: 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 unknown vectors.

Cómo lo explotan los atacantes

Ruta del atacante paso a paso

  1. 1

    These cross-domain policy files mean to allow Flash and Silverlight applications hosted on other domains to access its data:

  2. 2

    Flash crossdomain.xml :

  3. 3

    Silverlight clientaccesspolicy.xml :

  4. 4

    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.

Ejemplo de código vulnerable

Vulnerable XML

Flash crossdomain.xml :

Vulnerable XML
<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>
Ejemplo de código seguro

Secure pseudo

Seguro pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Lista de prevención

How to prevent CWE-942

  • Architecture and Design / Operation Define a restrictive Content Security Policy [REF-1486] or cross-domain policy file.
  • Architecture and Design / Operation 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 Design / Operation 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.
Señales de detección

How to detect CWE-942

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 searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Auto-corrección de Plexicus

Plexicus detecta automáticamente CWE-942 y abre un PR de corrección en menos de 60 segundos.

Codex Remedium escanea cada commit, identifica esta debilidad concreta y entrega un pull request listo para revisión con el parche. Sin tickets. Sin traspasos.

Preguntas frecuentes

Frequently asked questions

¿Qué es CWE-942?

This vulnerability occurs when a web application's cross-domain security policy, like a Content Security Policy (CSP), explicitly allows communication with untrusted or overly permissive external domains.

¿Qué gravedad tiene CWE-942?

MITRE no ha publicado una calificación de probabilidad de explotación para esta debilidad. Trátala como de impacto medio hasta que tu modelo de amenazas demuestre lo contrario.

¿Qué lenguajes o plataformas se ven afectados por CWE-942?

MITRE lists the following affected platforms: Web Based.

¿Cómo puedo prevenir CWE-942?

Define a restrictive Content Security Policy [REF-1486] or cross-domain policy file. 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.

¿Cómo detecta y corrige Plexicus CWE-942?

El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-942 en cada commit. Cuando hay coincidencia, nuestro agente Codex Remedium abre un PR de corrección con el código corregido, las pruebas y un resumen de una línea para el revisor.

¿Dónde puedo aprender más sobre CWE-942?

MITRE publica la definición canónica en https://cwe.mitre.org/data/definitions/942.html. También puedes consultar la documentación de OWASP y NIST para guías relacionadas.

Listo cuando tú lo estés

Deja de pagar por desarrollador.
Empieza a cerrar el bucle.

Plexicus es el ASPM nativo de IA que escanea, filtra, corrige, pentestea y explica — de forma autónoma. Desarrolladores ilimitados, repos ilimitados, acciones de IA de uso justo. Nivel gratuito real, €269/mo anual cuando estés listo.