CWE
CWE/SANS Top 25 Most Dangerous Software Errors Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > CWE- Individual Dictionary Definition (2.1)  

CWE-427: Uncontrolled Search Path Element

 
Uncontrolled Search Path Element
Weakness ID: 427 (Weakness Base)Status: Draft
+ Description

Description Summary

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 Description

Although 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 loaded

  • the 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.

+ Alternate Terms
DLL preloading:

This term is one of several that are used to describe exploitation of untrusted search path elements in Windows systems, which received wide attention in August 2010. From a weakness perspective, the term is imprecise because it can apply to both CWE-426 and CWE-427.

Binary planting:

This term is one of several that are used to describe exploitation of untrusted search path elements in Windows systems, which received wide attention in August 2010. From a weakness perspective, the term is imprecise because it can apply to both CWE-426 and CWE-427.

Insecure library loading:

This term is one of several that are used to describe exploitation of untrusted search path elements in Windows systems, which received wide attention in August 2010. From a weakness perspective, the term is imprecise because it can apply to both CWE-426 and CWE-427.

+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

Language-independent

Operating Systems

OS-independent

+ Common Consequences
ScopeEffect
Confidentiality
Integrity
Availability

Technical Impact: Execute unauthorized code or commands

+ Observed Examples
ReferenceDescription
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
CVE-1999-1461
CVE-1999-1318
CVE-2003-0579
CVE-2000-0854
CVE-2001-0943
CVE-2001-0942
CVE-2001-0507
CVE-2002-2017
CVE-1999-0690
CVE-2001-0912Error during packaging causes product to include a hard-coded, non-standard directory in search path.
CVE-2001-0289Product searches current working directory for configuration file.
CVE-2005-1705Product searches current working directory for configuration file.
CVE-2005-1307Product executable other program from current working directory.
CVE-2002-2040Untrusted path.
CVE-2005-2072Modification of trusted environment variable leads to untrusted path vulnerability.
CVE-2005-1632Product searches /tmp for modules before other paths.
+ Potential Mitigations

Phase: Implementation

Strategy: 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.

Phase: Implementation

Strategy: 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.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory417Channel and Path Errors
Development Concepts (primary)699
ChildOfWeakness ClassWeakness Class668Exposure of Resource to Wrong Sphere
Research Concepts (primary)1000
PeerOfCompound Element: CompositeCompound Element: Composite426Untrusted Search Path
Research Concepts1000
+ Relationship Notes

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

+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERUncontrolled Search Path Element
+ References
Georgi Guninski. "Double clicking on MS Office documents from Windows Explorer may execute arbitrary programs in some cases". Bugtraq. 2000-09-18.
Mitja Kolsek. "ACROS Security: Remote Binary Planting in Apple iTunes for Windows (ASPR #2010-08-18-1)". Bugtraq. 2010-08-18.
Taeho Kwon and Zhendong Su. "Automatic Detection of Vulnerable Dynamic Component Loadings". <http://www.cs.ucdavis.edu/research/tech-reports/2010/CSE-2010-2.pdf >.
"Dynamic-Link Library Search Order". Microsoft. 2010-09-02. <http://msdn.microsoft.com/en-us/library/ms682586%28v=VS.85%29.aspx>.
"Dynamic-Link Library Security". Microsoft. 2010-09-02. <http://msdn.microsoft.com/en-us/library/ff919712%28VS.85%29.aspx>.
"An update on the DLL-preloading remote attack vector". Microsoft. 2010-08-31. <http://blogs.technet.com/b/srd/archive/2010/08/23/an-update-on-the-dll-preloading-remote-attack-vector.aspx>.
"Insecure Library Loading Could Allow Remote Code Execution". Microsoft. 2010-08-23. <http://www.microsoft.com/technet/security/advisory/2269637.mspx>.
HD Moore. "Application DLL Load Hijacking". 2010-08-23. <http://blog.rapid7.com/?p=5325>.
Oliver Lavery. "DLL Hijacking: Facts and Fiction". 2010-08-26. <http://threatpost.com/en_us/blogs/dll-hijacking-facts-and-fiction-082610>.
+ Maintenance Notes

This weakness is not a clean fit under CWE-668 or CWE-610, which suggests that the control sphere model might need enhancement or clarification.

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
PLOVERExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Potential_Mitigations, Time_of_Introduction
2008-09-08CWE Content TeamMITREInternal
updated Relationships, Observed_Example, Other_Notes, Taxonomy_Mappings
2009-07-27CWE Content TeamMITREInternal
updated Description, Maintenance_Notes, Observed_Examples, Other_Notes, Potential_Mitigations, Relationships
2010-09-27CWE Content TeamMITREInternal
updated Alternate_Terms, Applicable_Platforms, Description, Maintenance_Notes, Observed_Examples, References, Relationship_Notes, Relationships
2011-03-29CWE Content TeamMITREInternal
updated Potential_Mitigations
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences
Page Last Updated: September 12, 2011