---
title: "CWE-939: Improper Authorization in Handler for Custom URL Scheme"
url: https://radicalnotion.ai/cwe/cwe-939
type: cwe
description: "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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-939: Improper Authorization in Handler for Custom URL Scheme

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 46
- **Of those, in CISA KEV:** 0
- **New in 2026:** 27
- **CWE catalog version:** 4.21

## Description

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.

Mobile platforms and other architectures allow the use of custom URL schemes to facilitate communication between applications. In the case of iOS, this is the only method to do inter-application communication. The implementation is at the developer's discretion which may open security flaws in the application. An example could be potentially dangerous functionality such as modifying files through a custom URL scheme.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Applicable platforms

**Technologies:** Mobile (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control, Other | Gain Privileges or Assume Identity, Varies by Context, Bypass Protection Mechanism | An attacker can access any functionality that is inadvertently accessible to the source. |

## Potential mitigations

### Architecture and Design

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.

## 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 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.)

## Demonstrative examples

### Example 1

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.

Good code:

```objective-c
NSString *stringURL = @"appscheme://replaceFileText?file=incomingMessage.txt&text=hello";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
```

Bad code:

```objective-c
- (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 code:

```html
<iframe src="appscheme://replaceFileText?file=Bookmarks.dat&text=listOfMaliciousWebsites">
```

### Example 2

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 code:

```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 code:

```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;
}
```

Attack code:

```javascript
window.location = examplescheme://method?parameter=value
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2013-5725 | URL scheme has action replace which requires no user prompt and allows remote attackers to perform undesired actions. |
| CVE-2013-5726 | URL scheme has action follow and favorite which allows remote attackers to force user to perform undesired actions. |

## Real CVEs with this weakness (sample of 12 of 46)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-53407 | - | critical | 9.8 | - | No | 2026-06-12 |
| CVE-2019-14809 | golang: malformed hosts in URLs leads to authorization bypass | critical | 9.8 | - | No | 2019-08-13 |
| CVE-2020-6522 | Inappropriate implementation in external protocol handlers | critical | 9.6 | - | No | 2020-07-22 |
| CVE-2026-35394 | Mobile Next has Arbitrary Android Intent Execution via mobile\_open\_url | high | 8.8 | - | No | 2026-04-06 |
| CVE-2023-43582 | - | high | 8.8 | - | No | 2023-11-14 |
| CVE-2019-5859 | Some URIs can load alternative browsers | high | 8.8 | - | No | 2019-11-25 |
| CVE-2026-6445 | - | high | 8.7 | - | No | 2026-06-09 |
| CVE-2024-33606 | MicroDicom DICOM Viewer Improper Authorization in Handler for Custom URL Scheme | high | 8.6 | - | No | 2024-06-11 |
| CVE-2026-53418 | - | high | 8.1 | - | No | 2026-10-13 |
| CVE-2026-53408 | - | high | 8.1 | - | No | 2026-06-12 |
| CVE-2020-15980 | Insufficient policy enforcement in Intents | high | 7.8 | - | No | 2020-11-03 |
| CVE-2026-1046 | Arbitrary application execution via unvalidated server-controlled URLs in Help menu | high | 7.6 | - | No | 2026-02-16 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-862](https://radicalnotion.ai/cwe/cwe-862) | Missing Authorization |
| Parent | [CWE-940](https://radicalnotion.ai/cwe/cwe-940) | Improper Verification of Source of a Communication Channel |

## Frequently asked questions

### What is CWE-939?

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.

### What CVEs are caused by CWE-939?

46 recorded CVEs are attributed to CWE-939, including CVE-2026-53407, CVE-2019-14809 and CVE-2020-6522.

### How do you prevent CWE-939?

Utilize a user prompt pop-up to authorize potentially harmful actions such as those modifying data or dealing with sensitive information.

### How is CWE-939 detected?

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 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.)

### What are the consequences of CWE-939?

Exploiting CWE-939 can lead to: Gain Privileges or Assume Identity, Varies by Context, Bypass Protection Mechanism.

### Is CWE-939 actively exploited?

46 recorded CVEs are caused by CWE-939; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/939.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-939). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
