[Forgot Password]
Login  Register Subscribe

30389

 
 

423868

 
 

247085

 
 

909

 
 

194218

 
 

282

Paid content will be excluded from the download.


Download | Alert*
CWE
view XML

Uncontrolled Search Path Element

ID: 427Date: (C)2012-05-14   (M)2022-10-10
Type: weaknessStatus: 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 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.

Applicable Platforms
Language Class: Language-independent
Operating System Class: OS-independent

Time Of Introduction

  • Implementation

Related Attack Patterns

Common Consequences

ScopeTechnical ImpactNotes
Confidentiality
Integrity
Availability
 
Execute unauthorized code or commands
 
 

Detection Methods
None

Potential Mitigations

PhaseStrategyDescriptionEffectivenessNotes
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.
 
  

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

Related CWETypeViewChain
CWE-427 ChildOf CWE-896 Category CWE-888  

Demonstrative Examples
None

Observed Examples

  1. CVE-2010-3402 : "DLL hijacking" issue in document editor.
  2. CVE-2010-3397 : "DLL hijacking" issue in encryption software.
  3. CVE-2010-3138 : "DLL hijacking" issue in library used by multiple media players.
  4. CVE-2010-3152 : "DLL hijacking" issue in illustration program.
  5. CVE-2010-3147 : "DLL hijacking" issue in address book.
  6. CVE-2010-3135 : "DLL hijacking" issue in network monitoring software.
  7. CVE-2010-3131 : "DLL hijacking" issue in web browser.
  8. CVE-2010-1795 : "DLL hijacking" issue in music player/organizer.
  9. 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.
  10. 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.
  11. CVE-1999-1318 : Software uses a search path that includes the current working directory (.), which allows local users to gain privileges via malicious programs.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. CVE-2002-2017 : Product allows local users to execute arbitrary code by setting an environment variable to reference a malicious program.
  18. CVE-1999-0690 : Product includes the current directory in root's PATH variable.
  19. CVE-2001-0912 : Error during packaging causes product to include a hard-coded, non-standard directory in search path.
  20. CVE-2001-0289 : Product searches current working directory for configuration file.
  21. CVE-2005-1705 : Product searches current working directory for configuration file.
  22. CVE-2005-1307 : Product executable other program from current working directory.
  23. CVE-2002-2040 : Untrusted path.
  24. CVE-2005-2072 : Modification of trusted environment variable leads to untrusted path vulnerability.
  25. 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

TaxynomyIdNameFit
PLOVER  Uncontrolled Search Path Element
 
 

References:

  1. Georgi Guninski .Double clicking on MS Office documents from Windows Explorer may execute arbitrary programs in some cases. Bugtraq. Published on 2000-09-18.
  2. Mitja Kolsek .ACROS Security: Remote Binary Planting in Apple iTunes for Windows (ASPR #2010-08-18-1). Bugtraq. Published on 2010-08-18.
  3. Taeho Kwon Zhendong Su .Automatic Detection of Vulnerable Dynamic Component Loadings.
  4. .Dynamic-Link Library Search Order. Microsoft. Published on 2010-09-02.
  5. .Dynamic-Link Library Security. Microsoft. Published on 2010-09-02.
  6. .An update on the DLL-preloading remote attack vector. Microsoft. Published on 2010-08-31.
  7. .Insecure Library Loading Could Allow Remote Code Execution. Microsoft. Published on 2010-08-23.
  8. HD Moore .Application DLL Load Hijacking. Published on 2010-08-23.
  9. Oliver Lavery .DLL Hijacking: Facts and Fiction. Published on 2010-08-26.
CVE    273
CVE-2016-4526
CVE-2016-6592
CVE-2016-5311
CVE-2014-8393
...

© SecPod Technologies