Incorrect Use of Privileged APIsID: 648 | Date: (C)2012-05-14 (M)2022-10-10 |
Type: weakness | Status: INCOMPLETE |
Abstraction Type: Base |
Description
The application does not conform to the API requirements for a
function call that requires extra privileges. This could allow attackers to gain
privileges by causing the function to be called
incorrectly.
Extended DescriptionWhen an application contains certain functions that perform operations
requiring an elevated level of privilege, the caller of a privileged API
must be careful to:ensure that assumptions made by the APIs are valid, such as validity
of argumentsaccount for known weaknesses in the design/implementation of the
APIcall the API from a safe contextIf the caller of the API does not follow these requirements, then it may
allow a malicious user or process to elevate their privilege, hijack the
process, or steal sensitive data.For instance, it is important to know if privileged APIs do not shed their
privileges before returning to the caller or if the privileged function
might make certain assumptions about the data, context or state information
passed to it by the caller. It is important to always know when and how
privileged APIs can be called in order to ensure that their elevated level
of privilege cannot be exploited.
Enabling Factors for ExploitationAn application contains functions running processes that hold higher
privileges.There is code in the application that calls the privileged APIs.There is a way for a user to control the data that is being passed to the
privileged API or control the context from which it is being called.
Likelihood of Exploit: Low
Applicable PlatformsLanguage Class: All
Time Of Introduction
- Architecture and Design
- Implementation
- Operation
Related Attack Patterns
Common Consequences
Scope | Technical Impact | Notes |
---|
Access_Control | Gain privileges / assume
identity | An attacker may be able to elevate privileges. |
Confidentiality | Read application
data | An attacker may be able to obtain sensitive information. |
IntegrityConfidentialityAvailability | Execute unauthorized code or
commands | An attacker may be able to execute code. |
Detection MethodsNone
Potential Mitigations
Phase | Strategy | Description | Effectiveness | Notes |
---|
Implementation | | Before calling privileged APIs, always ensure that the assumptions
made by the privileged code hold true prior to making the call. | | |
Architecture and Design | | Know architecture and implementation weaknesses of the privileged APIs
and make sure to account for these weaknesses before calling the
privileged APIs to ensure that they can be called safely. | | |
Implementation | | If privileged APIs make certain assumptions about data, context or
state validity that are passed by the caller, the calling code must
ensure that these assumptions have been validated prior to making the
call. | | |
Implementation | | If privileged APIs do not shed their privilege prior to returning to
the calling code, then calling code needs to shed these privileges
immediately and safely right after the call to the privileged APIs. In
particular, the calling code needs to ensure that a privileged thread of
execution will never be returned to the user or made available to
user-controlled processes. | | |
Implementation | | Only call privileged APIs from safe, consistent and expected state. | | |
Implementation | | Ensure that a failure or an error will not leave a system in a state
where privileges are not properly shed and privilege escalation is
possible (i.e. fail securely with regards to handling of privileges). | | |
Relationships
Related CWE | Type | View | Chain |
---|
CWE-648 ChildOf CWE-907 | Category | CWE-888 | |
Demonstrative ExamplesNone
Observed Examples
- : From http://xforce.iss.net/xforce/xfdb/12848: man-db is a Unix utility that displays online help files. man-db versions 2.3.12 beta and 2.3.18 to 2.4.1 could allow a local attacker to gain privileges, caused by a vulnerability when the open_cat_stream function is called. If man-db is installed setuid, a local attacker could exploit this vulnerability to gain "man" user privileges.
For more examples, refer to CVE relations in the bottom box.
White Box Definitions None
Black Box Definitions None
Taxynomy MappingsNone
References:None