Uncontrolled Search Path ElementID: 427 | Date: (C)2012-05-14 (M)2022-10-10 |
Type: weakness | Status: DRAFT |
Abstraction Type: Base |
Description
The product uses a fixed or controlled search path to find
resources, but one or more locations in that path can be under the control of
unintended actors.
Extended DescriptionAlthough this weakness can occur with any type of resource, it is
frequently introduced when a product uses a directory search path to find
executables or code libraries, but the path contains a directory that can be
modified by an attacker, such as "/tmp" or the current working directory.In Windows-based systems, when the LoadLibrary or LoadLibraryEx function
is called with a DLL name that does not contain a fully qualified path, the
function follows a search order that includes two path elements that might
be uncontrolled:the directory from which the program has been loadedthe current working directory.In some cases, the attack can be conducted remotely, such as when SMB or
WebDAV network shares are used.In some Unix-based systems, a PATH might be created that contains an empty
element, e.g. by splicing an empty variable into the PATH. This empty
element can be interpreted as equivalent to the current working directory,
which might be an untrusted search element.
Applicable PlatformsLanguage Class: Language-independentOperating System Class: OS-independent
Time Of Introduction
Related Attack Patterns
Common Consequences
Scope | Technical Impact | Notes |
---|
ConfidentialityIntegrityAvailability | Execute unauthorized code or
commands | |
Detection MethodsNone
Potential Mitigations
Phase | Strategy | Description | Effectiveness | Notes |
---|
Implementation | Input Validation | Assume all input is malicious. Use an "accept known good" input
validation strategy, i.e., use a whitelist of acceptable inputs that
strictly conform to specifications. Reject any input that does not
strictly conform to specifications, or transform it into something that
does.When performing input validation, consider all potentially relevant
properties, including length, type of input, the full range of
acceptable values, missing or extra inputs, syntax, consistency across
related fields, and conformance to business rules. As an example of
business rule logic, "boat" may be syntactically valid because it only
contains alphanumeric characters, but it is not valid if the input is
only expected to contain colors such as "red" or "blue."Do not rely exclusively on looking for malicious or malformed inputs
(i.e., do not rely on a blacklist). A blacklist is likely to miss at
least one undesirable input, especially if the code's environment
changes. This can give attackers enough room to bypass the intended
validation. However, blacklists can be useful for detecting potential
attacks or determining which inputs are so malformed that they should be
rejected outright. | | |
Implementation | Input Validation | Inputs should be decoded and canonicalized to the application's
current internal representation before being validated (CWE-180). Make
sure that the application does not decode the same input twice
(CWE-174). Such errors could be used to bypass whitelist validation
schemes by introducing dangerous inputs after they have been
checked. | | |
RelationshipsUnlike untrusted search path (CWE-426), which inherently involves control
over the definition of a control sphere (i.e., modification of a search
path), this entry concerns a fixed control sphere in which some part of the
sphere may be under attacker control (i.e., the search path cannot be
modified by an attacker, but one element of the path can be under attacker
control).
Related CWE | Type | View | Chain |
---|
CWE-427 ChildOf CWE-896 | Category | CWE-888 | |
Demonstrative ExamplesNone
Observed Examples
- CVE-2010-3402 : "DLL hijacking" issue in document editor.
- CVE-2010-3397 : "DLL hijacking" issue in encryption software.
- CVE-2010-3138 : "DLL hijacking" issue in library used by multiple media players.
- CVE-2010-3152 : "DLL hijacking" issue in illustration program.
- CVE-2010-3147 : "DLL hijacking" issue in address book.
- CVE-2010-3135 : "DLL hijacking" issue in network monitoring software.
- CVE-2010-3131 : "DLL hijacking" issue in web browser.
- CVE-2010-1795 : "DLL hijacking" issue in music player/organizer.
- CVE-2002-1576 : Product uses the current working directory to find and execute a program, which allows local users to gain privileges by creating a symlink that points to a malicious version of the program.
- CVE-1999-1461 : Product trusts the PATH environmental variable to find and execute a program, which allows local users to obtain root access by modifying the PATH to point to a malicous version of that program.
- CVE-1999-1318 : Software uses a search path that includes the current working directory (.), which allows local users to gain privileges via malicious programs.
- CVE-2003-0579 : Admin software trusts the user-supplied -uv.install command line option to find and execute the uv.install program, which allows local users to gain privileges by providing a pathname that is under control of the user.
- CVE-2000-0854 : When a document is opened, the directory of that document is first used to locate DLLs , which could allow an attacker to execute arbitrary commands by inserting malicious DLLs into the same directory as the document.
- CVE-2001-0943 : Database trusts the PATH environment variable to find and execute programs, which allows local users to modify the PATH to point to malicious programs.
- CVE-2001-0942 : Database uses the an environment variable to find and execute a program, which allows local users to execute arbitrary programs by changing the environment variable.
- CVE-2001-0507 : Server uses relative paths to find system files that will run in-process, which allows local users to gain privileges via a malicious file.
- CVE-2002-2017 : Product allows local users to execute arbitrary code by setting an environment variable to reference a malicious program.
- CVE-1999-0690 : Product includes the current directory in root's PATH variable.
- CVE-2001-0912 : Error during packaging causes product to include a hard-coded, non-standard directory in search path.
- CVE-2001-0289 : Product searches current working directory for configuration file.
- CVE-2005-1705 : Product searches current working directory for configuration file.
- CVE-2005-1307 : Product executable other program from current working directory.
- CVE-2002-2040 : Untrusted path.
- CVE-2005-2072 : Modification of trusted environment variable leads to untrusted path vulnerability.
- CVE-2005-1632 : Product searches /tmp for modules before other paths.
For more examples, refer to CVE relations in the bottom box.
White Box Definitions None
Black Box Definitions None
Taxynomy Mappings
Taxynomy | Id | Name | Fit |
---|
PLOVER | | Uncontrolled Search Path Element | |
References:
- Georgi Guninski .Double clicking on MS Office documents from Windows Explorer
may execute arbitrary programs in some cases. Bugtraq. Published on 2000-09-18.
- Mitja Kolsek .ACROS Security: Remote Binary Planting in Apple iTunes for
Windows (ASPR #2010-08-18-1). Bugtraq. Published on 2010-08-18.
- Taeho Kwon Zhendong Su .Automatic Detection of Vulnerable Dynamic Component
Loadings.
- .Dynamic-Link Library Search Order. Microsoft. Published on 2010-09-02.
- .Dynamic-Link Library Security. Microsoft. Published on 2010-09-02.
- .An update on the DLL-preloading remote attack
vector. Microsoft. Published on 2010-08-31.
- .Insecure Library Loading Could Allow Remote Code
Execution. Microsoft. Published on 2010-08-23.
- HD Moore .Application DLL Load Hijacking. Published on 2010-08-23.
- Oliver Lavery .DLL Hijacking: Facts and Fiction. Published on 2010-08-26.