Security weakness
CWE-942 Permissive cross-domain policy (CORS)
Your site’s browser security policy trusts domains it should not, letting other websites read data or run scripts.
- Senior security engineers
- 540+ projects delivered
- Reply within one business day
Quick answer
What is 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 the web client is allowed to communicate.
Business impact
What CWE-942 could cost your business
MITRE documents what this weakness can do. Here is what that means for a website, store or app.
Confidentiality
Private data exposed
Customer records, credentials, orders or internal files can be read by people who should never see them.
- Execute Unauthorized Code or Commands
- Bypass Protection Mechanism
- Read Application Data
Integrity
Data, pages or code changed
Prices, orders, content or the code your site runs can be altered without your approval.
- Execute Unauthorized Code or Commands
- Bypass Protection Mechanism
- Read Application Data
Availability
Downtime and lost sales
Crashes, slowdowns or exhausted resources can take your site, store or app offline.
- Execute Unauthorized Code or Commands
- Bypass Protection Mechanism
- Read Application Data
Access Control
Accounts and admin areas exposed
Logins and permission checks can be bypassed, putting admin and customer accounts at risk.
- Execute Unauthorized Code or Commands
- Bypass Protection Mechanism
- Read Application Data
In plain English
What Permissive cross-domain policy (CORS) means for your business
- 540+projects delivered
- 9+years in business
- 23+certified experts
A senior engineer replies within one business day.
Browsers normally stop one website from reading another site’s data. Sites loosen that rule on purpose using policies: CORS headers say which other sites may read your responses, and a Content Security Policy says where scripts and other resources may load from. This weakness means the policy is too generous, often through a wildcard that trusts every domain or far more domains than intended.
An over-broad policy quietly removes a protection you assume is there. If any website may read your API responses with a visitor’s login attached, a malicious page can pull that visitor’s account data while they browse. If your script policy trusts a wide range of hosts, it no longer limits the damage of a script injection. Visitors notice nothing, and neither do you.
Where it shows up
- APIs that copy whatever Origin header the browser sends into Access-Control-Allow-Origin and also allow credentials, which trusts every website on the internet.
- CORS allowlists that match loosely, such as accepting any domain that merely contains or ends with your name, or trusting the null origin.
- Content Security Policy headers with wildcards, whole CDN or cloud hosting domains, or unsafe-inline, added to make a third-party script work.
- Wildcard trust of all subdomains when some of them host user content, old campaign sites or services run by third parties.
Free security check
Is CWE-942 hiding in your site?
A senior engineer checks your site, store or app for this weakness and the rest of the CWE Top 25, then sends a prioritized fix plan within one business day. No obligation.
Official definition
How MITRE defines 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 the web client is allowed to communicate.
Fix it
How to fix Permissive cross-domain policy (CORS)
Practical steps in priority order. Share them with your developer or agency.
Use an exact origin allowlist
Compare the request’s Origin header against a fixed list of full origins you control, using exact string matching. Return that origin only on a match, add Vary: Origin and never reflect arbitrary values.
Never mix wildcards with credentials
Use a wildcard origin only for truly public, unauthenticated resources. For anything that relies on cookies or tokens, name specific origins, and do not trust the null origin or plain HTTP origins.
Tighten your Content Security Policy
Replace wildcards and broad hosts in script-src with nonces or hashes and specific origins. Set default-src to ‘self’, remove unsafe-inline and add object-src ‘none’ and base-uri ‘self’.
Limit methods, headers and exposure
Allow only the HTTP methods and request headers each endpoint needs, and expose only necessary response headers. Apply CORS per route rather than globally, so admin and account endpoints stay closed to other sites.
Review and test policies regularly
Keep policies in version control with a note explaining each trusted origin. Remove retired domains and unused subdomains, test with automated header checks in your pipeline and use CSP report-only mode before tightening.
Signs you may be affected
- API responses echo back any Origin value you send, alongside Access-Control-Allow-Credentials set to true.
- Your Content Security Policy contains an asterisk, unsafe-inline or very broad hosting domains.
- Nobody can explain why each domain in your CORS or CSP allowlist is there.
Questions to ask your developer
- Which websites are allowed to read our API responses, and why each one?
- Does our CORS setup ever combine credentials with a wildcard or reflected origin?
- Does our Content Security Policy use wildcards or unsafe-inline anywhere?
Prevention
What MITRE recommends, phase by phase
Every mitigation from the CWE entry, in the order a project runs: plan, build, test, operate.
- 01
Architecture and Design
- 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.
- 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 and evidence
How CWE-942 is found, and where it has hit
The testing methods MITRE recommends, and real vulnerabilities this weakness has caused.
How it is detected
- Automated Static AnalysisAutomated 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.
Real vulnerabilities it caused
- 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 allow 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 scripting (XSS).
- 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 unknown vectors.
How we fix it
From finding to fixed: how Codefreex closes CWE-942
Scan and confirm
We test your site, store or app for this weakness and the rest of the CWE Top 25 with automated scanning and manual review, and confirm what is actually exploitable.
Fix at the source
We change the code, configuration or dependency that causes it, not just the symptom, and plan the changes to avoid downtime.
Verify the fix
We retest every finding, check that nothing else broke and hand you a short report you can share with your team, client or auditor.
Keep it fixed
Updates, monitoring and maintenance so the weakness does not return with the next plugin, theme, app or code change.
Website SecurityPenetration TestingMalware Removal & Hack RepairWordPress Maintenance
Related weaknesses
Weaknesses related to CWE-942
FAQ
CWE-942: FAQs
Short answers for owners and developers. Not sure whether your site is affected? Ask us to check.
What is CORS, in simple terms?
CORS stands for cross-origin resource sharing. It is a set of response headers your server uses to tell browsers which other websites may read its responses. Without it, browsers block such access by default. It is an intentional relaxation of a safety rule, so each origin you add should be one you own or fully trust.
How serious is an overly permissive cross-domain policy?
It depends on what the policy protects. On public, read-only content the risk is small. On an API that returns account data to logged-in users, a permissive policy with credentials can let any website a visitor opens read that data, which is a serious privacy exposure. A loose script policy also weakens your defense against script injection.
How do I set a safe cross-domain policy?
Start from deny and add only what you need. List exact trusted origins for CORS and validate them with exact matching on the server. Avoid wildcards wherever credentials are involved. For Content Security Policy, use nonces or hashes with specific sources. Document each entry, test in report-only mode and review the lists whenever domains or vendors change.
What is CWE-942?
CWE-942, “Permissive Cross-domain Security Policy with Untrusted Domains”, is a software weakness catalogued by MITRE in the Common Weakness Enumeration. 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.
How serious is CWE-942?
It can affect confidentiality, integrity, availability, access control, with impacts such as execute unauthorized code or commands, bypass protection mechanism, read application data. The real risk depends on where the weakness sits and what data or functions it exposes.
How do you prevent 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.
Can Codefreex check my site for CWE-942?
Yes. A senior engineer reviews your site, store or app for CWE-942 and the rest of the CWE Top 25, confirms what is exploitable and sends a prioritized fix plan within one business day. Start with the free security check form on this page.
Free security check
Find out if CWE-942 affects your site
Send your URL. A senior engineer checks for this weakness and the rest of the CWE Top 25, and replies within one business day with what to fix first.
- A senior strategist reviews your request, not a sales bot
- Clear scope, timeline and estimate within one business day
- Free 30-minute discovery call, no obligation
- NDA available on request
- Emailhello@codefreex.com
- CallUSA +1 (209) 375-3475 · India +91 790 3375 530
- Prefer to talk?Book a 30-minute call
Weakness data from the Common Weakness Enumeration (CWE®) version 5.0, Copyright © 2006–2026, The MITRE Corporation. CWE is free to use by any organization or individual for any research, development, and/or commercial purposes under the CWE Terms of Use. CWE is a registered trademark of The MITRE Corporation. The business impact, risk profile and plain-English guidance on this page are written by Codefreex and are general information, not a security assessment of your system.