CWE-939: Improper Authorization in Handler for Custom URL Scheme
The product uses a handler for a custom URL scheme, but it does not properly restrict which actors can invoke the handler using the scheme.
Last updated
The product uses a handler for a custom URL scheme, but it does not properly restrict which actors can invoke the handler using the scheme.
Last updated
46 recorded CVEs are caused by CWE-939 (Improper Authorization in Handler for Custom URL Scheme). The highest-severity and most recent are shown first. 27 new CWE-939 CVEs have been recorded so far in 2026 (3 in 2025).
golang: malformed hosts in URLs leads to authorization bypass
Inappropriate implementation in external protocol handlers
Mobile Next has Arbitrary Android Intent Execution via mobile_open_url
Some URIs can load alternative browsers
MicroDicom DICOM Viewer Improper Authorization in Handler for Custom URL Scheme
Insufficient policy enforcement in Intents
Arbitrary application execution via unvalidated server-controlled URLs in Help menu
Showing 12 of 46 recorded CWE-939 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-939 is exploited.
Gain Privileges or Assume Identity, Varies by Context, Bypass Protection Mechanism
Affects: Access Control, Other
An attacker can access any functionality that is inadvertently accessible to the source.
Typically introduced during these phases of the software lifecycle.
Technologies
Practical mitigations for CWE-939, grouped by where in the lifecycle they apply.
Utilize a user prompt pop-up to authorize potentially harmful actions such as those modifying data or dealing with sensitive information.
When designing functionality of actions in the URL scheme, consider whether the action should be accessible to all mobile applications, or if an allowlist of applications to interface with is appropriate.
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 searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
MITRE examples of the weakness in code.
This iOS application uses a custom URL scheme. The replaceFileText action in the URL scheme allows an external application to interface with the file incomingMessage.txt and replace the contents with the text field of the query string.
Safe example
NSString *stringURL = @"appscheme://replaceFileText?file=incomingMessage.txt&text=hello";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];Vulnerable example
- (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;
}Attack input
<iframe src="appscheme://replaceFileText?file=Bookmarks.dat&text=listOfMaliciousWebsites">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:
Vulnerable example
// 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;
}
}
}Vulnerable example
// 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;
}Attack input
window.location = examplescheme://method?parameter=valueReal CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-939.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-939 CVE affects your products, with AI-written analysis and remediation steps.