CWE-940 通信信道源的不正确验证

  • A+

CWE-940 通信信道源的不正确验证

Improper Verification of Source of a Communication Channel

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: unkown


The software establishes a communication channel to handle an incoming request that has been initiated by an actor, but it does not properly verify that the request is coming from the expected origin.


When an attacker can successfully establish a communication channel from an untrusted origin, the attacker may be able to gain privileges and access unexpected functionality.


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

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


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

Paradigm: {'cwe_Name': 'Mobile', '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.


Architecture and Design


Use a mechanism that can validate the identity of the source, such as a certificate, and validate the integrity of data to ensure that it cannot be modified in transit using a man-in-the-middle attack.
When designing functionality of actions in the URL scheme, consider whether the action should be accessible to all mobile applications, or if a whitelist of applications to interface with is appropriate.


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 {

public void onReceive(Context context, Intent intent) {

int userID = intent.getIntExtra("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

public boolean shouldOverrideUrlLoading(WebView view, String url){

if (url.substring(0,14).equalsIgnoreCase("examplescheme:")){


writeDataToView(view, UserData);
return false;


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
CVE-2005-0877 DNS server can accept DNS updates from hosts that it did not query, leading to cache poisoning
CVE-2001-1452 DNS server caches glue records received from non-delegated name servers



  • CAPEC-594
  • CAPEC-595
  • CAPEC-596




:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: