1840
CWE-939: Improper Authorization in Handler for Custom URL Scheme
Weakness ID : 939
Structure : Simple
Abstraction : Base
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.
Extended Description
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 interapplication
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.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 862 Missing Authorization 1780
Relevant to the view "Architectural Concepts" (CWE-1008)
Nature Type ID Name Page
MemberOf 1011 Authorize Actors 2425
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 1212 Authorization Errors 2476
Applicable Platforms
Technology : Mobile (Prevalence = Undetermined)
Potential Mitigations
Phase: 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.
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.
External Application
Example Language: Objective-C (Good)
NSString *stringURL = @"appscheme://replaceFileText?file=incomingMessage.txt&text=hello";
NSURL *url = [NSURL URLWithString:stringURL];
CWE Version 4.14
CWE-939: Improper Authorization in Handler for Custom URL Scheme
CWE-939: Improper Authorization in Handler for Custom URL Scheme