CWE-346 源验证错误

Origin Validation Error

结构: Simple

Abstraction: Base

状态: Draft

被利用可能性: unkown

基本描述

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

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 345 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 345 cwe_View_ID: 1003 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 345 cwe_View_ID: 699 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 284 cwe_View_ID: 1000

  • cwe_Nature: ChildOf cwe_CWE_ID: 284 cwe_View_ID: 699

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
['Access Control', 'Other'] ['Gain Privileges or Assume Identity', 'Varies by Context'] An attacker can access any functionality that is inadvertently accessible to the source.

示例代码

This Android application will remove a user account when it receives an intent to do so:

bad Java

IntentFilter filter = new IntentFilter("com.example.RemoveUser");
MyReceiver receiver = new MyReceiver();
registerReceiver(receiver, filter);

public class DeleteReceiver extends BroadcastReceiver {
@Override
public 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 a whitelist 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 Java


// Android
@Override
public 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 Objective-C


// 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 JavaScript

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.

分析过的案例

标识 说明 链接
CVE-2000-1218 DNS server can accept DNS updates from hosts that it did not query, leading to cache poisoning https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1218
CVE-2005-0877 DNS server can accept DNS updates from hosts that it did not query, leading to cache poisoning https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0877
CVE-2001-1452 DNS server caches glue records received from non-delegated name servers https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1452
CVE-2005-2188 user ID obtained from untrusted source (URL) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2188
CVE-2003-0174 LDAP service does not verify if a particular attribute was set by the LDAP server https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-0174
CVE-1999-1549 product does not sufficiently distinguish external HTML from internal, potentially dangerous HTML, allowing bypass using special strings in the page title. Overlaps special elements. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-1549
CVE-2003-0981 product records the reverse DNS name of a visitor in the logs, allowing spoofing and resultant XSS. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-0981

Notes

Maintenance This entry has some significant overlap with other CWE entries and may need some clarification. See terminology notes. Terminology The "Origin Validation Error" term was used by Taimur Aslam in his August 1995 thesis. Although not formally defined, an issue is considered to be an origin validation error if either (1) "an object [accepts] input from an unauthorized subject," or (2) "the system [fails] to properly or completely authenticate a subject." A later section says that an origin validation error can occur when the system (1) "does not properly authenticate a user or process" or (2) "does not properly authenticate the shared data or libraries." The only example provided in the thesis (covered by OSVDB:57615) involves a setuid program running command-line arguments without dropping privileges. So, this definition (and its examples in the thesis) effectively cover other weaknesses such as CWE-287 (Improper Authentication), CWE-285 (Improper Authorization), and CWE-250 (Execution with Unnecessary Privileges). There appears to be little usage of this term today, except in the SecurityFocus vulnerability database, where the term is used for a variety of issues, including web-browser problems that allow violation of the Same Origin Policy and improper validation of the source of an incoming message.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Origin Validation Error

相关攻击模式

  • CAPEC-111
  • CAPEC-141
  • CAPEC-142
  • CAPEC-160
  • CAPEC-21
  • CAPEC-384
  • CAPEC-385
  • CAPEC-386
  • CAPEC-387
  • CAPEC-388
  • CAPEC-510
  • CAPEC-59
  • CAPEC-60
  • CAPEC-75
  • CAPEC-76
  • CAPEC-89

引用