Exposed Dangerous Method or Function
The software provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted.
This weakness can lead to a wide variety of resultant weaknesses, depending on the behavior of the exposed method. It can apply to any number of technologies and approaches, such as ActiveX controls, Java functions, IOCTLs, and so on.
The exposure can occur in a few different ways:
) The function/method was never intended to be exposed to outside actors.
) The function/method was only intended to be accessible to a limited set of actors, such as Internet-based access from a single web site.
The following examples help to illustrate the nature of this weakness and describe methods or techniques which can be used to mitigate the risk.
Note that the examples here are by no means exhaustive and any given weakness may have many subtle varieties, each of which may require different detection methods or runtime controls.
In the following Java example the method removeDatabase will delete the database with the name specified in the input parameter.
The method in this example is declared public and therefore is exposed to any class in the application. Deleting a database should be considered a critical operation within an application and access to this potentially dangerous method should be restricted. Within Java this can be accomplished simply by declaring the method private thereby exposing it only to the enclosing class as in the following example.
A call into native code can then be initiated by passing parameters within the URL:
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.
For example, if the application has permission to send text messages:
This malicious script can use the userInfoObject object to load the SmsManager object and send arbitrary text messages to any recipient.
This code is not vulnerable to the above attack, but still may expose user info to malicious pages loaded in the WebView. Even malicious iframes loaded within a trusted page may access the exposed interface:
This malicious code within an iframe is able to access the interface object and steal the user's data.
Weaknesses in this category are related to the use of built-in functions or external APIs.
This category identifies Software Fault Patterns (SFPs) within the Architecture cluster.
This view (slice) covers all the elements in CWE.
CWE identifiers in this view are weaknesses that do not have associated Software Fault Patterns (SFPs), as covered by the CWE-888 view. As such, they represent gaps in...
This view (slice) lists weaknesses that can be introduced during implementation.