Class · High

CWE-346: Origin Validation Error

The product does not properly verify that the source of data or communication is valid.

CWE-346 · Class Level ·10 CVEs

Description

The product does not properly verify that the source of data or communication is valid.

Potential Impact

Access Control, Other

Gain Privileges or Assume Identity, Varies by Context

Demonstrative Examples

This Android application will remove a user account when it receives an intent to do so:
Bad
IntentFilter filter = new IntentFilter("com.example.RemoveUser");MyReceiver receiver = new MyReceiver();registerReceiver(receiver, filter);
                     public class DeleteReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {int userID = intent.getIntExtra("userID");destroyUserData(userID);}}
This application does not check the origin of the intent, thus allowing any malicious application to remove a user. Always check the origin of an intent, or create an allowlist of trusted applications using the manifest.xml file.
These Android and iOS applications intercept URL loading within a WebView and perform special actions if a particular URL scheme is used, thus allowing the Javascript within the WebView to communicate with the application:
Bad
// Android
                     @Overridepublic boolean shouldOverrideUrlLoading(WebView view, String url){
                        if (url.substring(0,14).equalsIgnoreCase("examplescheme:")){if(url.substring(14,25).equalsIgnoreCase("getUserInfo")){writeDataToView(view, UserData);return false;}else{return true;}}
                     }
Bad
// iOS
                     -(BOOL) webView:(UIWebView *)exWebView shouldStartLoadWithRequest:(NSURLRequest *)exRequest navigationType:(UIWebViewNavigationType)exNavigationType{
                        NSURL *URL = [exRequest URL];if ([[URL scheme] isEqualToString:@"exampleScheme"]){
                              NSString *functionString = [URL resourceSpecifier];if ([functionString hasPrefix:@"specialFunction"]){
                                    
                                       
                                       // Make data available back in webview.
                                       UIWebView *webView = [self writeDataToView:[URL query]];
                                 }return NO;
                           }return YES;
                     }
A call into native code can then be initiated by passing parameters within the URL:
Attack
window.location = examplescheme://method?parameter=value
Because the application does not check the source, a malicious website loaded within this WebView has the same access to the API as a trusted site.

Detection Methods

  • Automated Static Analysis — 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-2000-1218DNS server can accept DNS updates from hosts that it did not query, leading to cache poisoning
CVE-2018-6074Browser does not set Mark-of-the-Web (MotW) for a downloaded .EXE file if the name is close to the maximum path length, preventing recording of a zone identifier in the filename
CVE-2025-0411Zip file extraction program does not propagate Mark-of-the-Web (MotW) metadata to files that are extracted from an Internet-downloaded Zip file
CVE-2025-46652Zip file extraction program does not propagate Mark-of-the-Web (MotW) metadata to files that are extracted from an Internet-downloaded Zip file
CVE-2005-0877DNS server can accept DNS updates from hosts that it did not query, leading to cache poisoning
CVE-2001-1452DNS server caches glue records received from non-delegated name servers
CVE-2005-2188user ID obtained from untrusted source (URL)
CVE-2003-0174LDAP service does not verify if a particular attribute was set by the LDAP server
CVE-1999-1549product does not sufficiently distinguish external HTML from internal, potentially dangerous HTML, allowing bypass using special strings in the page title. Overlaps special elements.
CVE-2003-0981product records the reverse DNS name of a visitor in the logs, allowing spoofing and resultant XSS.

Taxonomy Mappings

  • PLOVER: — Origin Validation Error
  • ISA/IEC 62443: Part 3-3 — Req SR 2.12 RE(1)
  • ISA/IEC 62443: Part 4-1 — Req SD-1
  • ISA/IEC 62443: Part 4-1 — Req SR-2
  • ISA/IEC 62443: Part 4-1 — Req SVV-1
  • ISA/IEC 62443: Part 4-2 — Req CR 2.12 RE(1)
  • ISA/IEC 62443: Part 4-2 — Req CR 3.1 RE(1)

Frequently Asked Questions

What is CWE-346?

CWE-346 (Origin Validation Error) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product does not properly verify that the source of data or communication is valid.

How can CWE-346 be exploited?

Attackers can exploit CWE-346 (Origin Validation Error) to gain privileges or assume identity, varies by context. This weakness is typically introduced during the Architecture and Design, Implementation phase of software development.

How do I prevent CWE-346?

Follow secure coding practices, conduct code reviews, and use automated security testing tools (SAST/DAST) to detect this weakness early in the development lifecycle.

What is the severity of CWE-346?

CWE-346 is classified as a Class-level weakness (High abstraction). It has been observed in 10 real-world CVEs.