12 vulnerabilities classified as CWE-939 (自定义URL方案处理程序中的授权不正确). AI Chinese analysis included.
CWE-939 represents a critical access control weakness where applications fail to validate the source of requests invoking custom URL schemes. This flaw typically allows malicious actors to trick users into clicking crafted links or embeds that trigger unintended actions within the target application, such as executing privileged commands or accessing sensitive data without proper authentication. Since custom schemes often serve as vital inter-application communication channels, particularly on mobile platforms like iOS, this vulnerability can lead to significant security breaches. Developers can mitigate this risk by implementing strict authorization checks within the handler logic, ensuring that only trusted or explicitly authorized applications can invoke specific scheme actions. Additionally, validating the origin of incoming requests and requiring user confirmation for sensitive operations further strengthens the application’s defense against unauthorized access and exploitation.
NSString *stringURL = @"appscheme://replaceFileText?file=incomingMessage.txt&text=hello"; NSURL *url = [NSURL URLWithString:stringURL]; [[UIApplication sharedApplication] openURL:url];- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { if (!url) { return NO; } NSString *action = [url host]; if([action isEqualToString: @"replaceFileText"]) { NSDictionary *dict = [self parseQueryStringExampleFunction:[url query]]; //this function will write contents to a specified file FileObject *objectFile = [self writeToFile:[dict objectForKey: @"file"] withText:[dict objectForKey: @"text"]]; } return YES; }// 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; } } }// 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; }Vulnerabilities classified as CWE-939 (自定义URL方案处理程序中的授权不正确) represent 12 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.