CWEweakness

CWE-427 Uncontrolled Search Path Element

Official page ↗
Alternate terms
DLL preloading, Binary planting, Insecure library loading, Dependency confusion
Abstraction
Base
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

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. One or more locations in that path could include the Windows drive root or its subdirectories. This often exists in Linux-based code assuming the controlled nature of the root directory (/) or its subdirectories (/etc, etc), or a code that recursively accesses the parent directory. In Windows, the drive root and some of its subdirectories have weak permissions by default, which makes them uncontrolled. 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. In software package management frameworks (e.g., npm, RubyGems, or PyPi), the framework may identify dependencies on third-party libraries or other packages, then consult a repository that contains the desired package. The framework may search a public repository before a private repository. This could be exploited by attackers by placing a malicious package in the public repository that has the same name as a package from the private repository. The search path might not be directly under control of the developer relying on the framework, but this search order effectively contains an untrusted element.

Common consequences

• Confidentiality, Integrity, Availability: Execute Unauthorized Code or Commands

Potential mitigations

• [Architecture and Design, Implementation] Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428. • [Implementation] When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths. • [Implementation] Remove or restrict all environment settings before invoking other programs. This includes the PATH environment variable, LD_LIBRARY_PATH, and other settings that identify the location of code libraries, and any application-specific search paths. • [Implementation] Check your search path before use and remove any elements that are likely to be unsafe, such as the current working directory or a temporary files directory. Since this is a denylist approach, it might not be a complete solution. • [Implementation] Use other functions that require explicit paths. Making use of any of the other readily available functions that require explicit paths is a safe way to avoid this problem. For example, system() in C does not require a full path since the shell can take care of finding the program using the PATH environment variable, while execl() and execv() require a full path.

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Observed examples

• CVE-2023-25815: Chain: a change in an underlying package causes the gettext function to use implicit initialization with a hard-coded path (CWE-1419) under the user-writable C:\ drive, introducing an untrusted search path element (CWE-427) that enables spoofing of messages. • CVE-2022-4826: Go-based git extension on Windows can search for and execute a malicious "..exe" in a repository because Go searches the current working directory if git.exe is not found in the PATH • CVE-2020-26284: A Static Site Generator built in Go, when running on Windows, searches the current working directory for a command, possibly allowing code execution using a malicious .exe or .bat file with the name being searched • CVE-2022-24765: Windows-based fork of git creates a ".git" folder in the C: drive, allowing local attackers to create a .git folder with a malicious config file • CVE-2019-1552: SSL package searches under "C:/usr/local" for configuration files and other critical data, but C:/usr/local might be world-writable. • 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 malicious 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 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.

Related

Attack pattern · CAPEC (2)

  • CAPEC-38 Leveraging/Manipulating Configuration File Search Paths attack pattern
  • CAPEC-471 Search Order Hijacking attack pattern

Observed example · CVE (30)

  • CVE-2023-25815 In Git for Windows, the Windows port of Git, no localized messages are shipped with the installer. vulnerability
  • CVE-2022-4826 The Simple Tooltips WordPress plugin before 2.1.4 does not validate and escape some of its shortcode attributes before outputting them back… vulnerability
  • CVE-2022-24765 Git for Windows is a fork of Git containing Windows-specific patches. vulnerability
  • CVE-2020-26284 Hugo is a fast and Flexible Static Site Generator built in Go. vulnerability
  • CVE-2019-1552 OpenSSL has internal defaults for a directory tree where it can find a configuration file as well as certificates used for verification in… vulnerability
  • CVE-2010-3402 Untrusted search path vulnerability in IDM Computer Solutions UltraEdit 16.20.0.1009, 16.10.0.1036, and probably other versions allows… vulnerability
  • CVE-2010-3397 Untrusted search path vulnerability in PGP Desktop 9.9.0 Build 397, 9.10.x, 10.0.0 Build 2732, and probably other versions allows local… vulnerability
  • CVE-2010-3138 Untrusted search path vulnerability in the Indeo Codec in iac25_32.ax in Microsoft Windows XP SP3 allows local users to gain privileges via… vulnerability
  • CVE-2010-3147 Untrusted search path vulnerability in wab.exe 6.00.2900.5512 in Windows Address Book in Microsoft Windows XP SP2 and SP3, Windows Server… vulnerability
  • CVE-2010-3152 Untrusted search path vulnerability in Adobe Illustrator CS4 14.0.0, CS5 15.0.1 and earlier, and possibly other versions allows local… vulnerability
  • CVE-2010-3131 Untrusted search path vulnerability in Mozilla Firefox before 3.5.12 and 3.6.x before 3.6.9, Thunderbird before 3.0.7 and 3.1.x before… vulnerability
  • CVE-2010-3135 Untrusted search path vulnerability in Cisco Packet Tracer 5.2 allows local users, and possibly remote attackers, to execute arbitrary code… vulnerability
  • CVE-2010-1795 Untrusted search path vulnerability in Apple iTunes before 9.1, when running on Windows 7, Vista, and XP, allows local users and possibly… vulnerability
  • CVE-2005-2072 The runtime linker (ld.so) in Solaris 8, 9, and 10 trusts the LD_AUDIT environment variable in setuid or setgid programs, which allows… vulnerability
  • CVE-2005-1705 gdb before 6.3 searches the current working directory to load the .gdbinit configuration file, which allows local users to execute… vulnerability
  • CVE-2005-1307 The (1) stopserver.sh and (2) startserver.sh scripts in Adobe Version Cue on Mac OS X uses the current working directory to find and… vulnerability
  • CVE-2005-1632 Cheetah 0.9.15 and 0.9.16 searches the /tmp directory for modules before using the paths in the PYTHONPATH variable, which allows local… vulnerability
  • CVE-2002-1576 lserver in SAP DB 7.3 and earlier uses the current working directory to find and execute the lserversrv program, which allows local users… vulnerability
  • CVE-2003-0579 uvadmsh in IBM U2 UniVerse 10.0.0.9 and earlier trusts the user-supplied -uv.install command line option to find and execute the uv.install… vulnerability
  • CVE-2002-2017 sastcpd in SAS/Base 8.0 allows local users to execute arbitrary code by setting the authprog environment variable to reference a malicious… vulnerability
  • CVE-2002-2040 The (1) phrafx and (2) phgrafx-startup programs in QNX realtime operating system (RTOS) 4.25 and 6.1.0 do not properly drop privileges… vulnerability
  • CVE-2001-0912 Packaging error for expect 8.3.3 in Mandrake Linux 8.1 causes expect to search for its libraries in the /home/snailtalk directory before… vulnerability
  • CVE-2001-0942 dbsnmp in Oracle 8.1.6 and 8.1.7 uses the ORACLE_HOME environment variable to find and execute the dbsnmp program, which allows local users… vulnerability
  • CVE-2001-0507 IIS 5.0 uses relative paths to find system files that will run in-process, which allows local users to gain privileges via a Trojan horse… vulnerability
  • CVE-2001-0943 dbsnmp in Oracle 8.0.5 and 8.1.5, under certain conditions, trusts the PATH environment variable to find and execute the (1) chown or (2)… vulnerability
  • CVE-2001-0289 Joe text editor 2.8 searches the current working directory (CWD) for the .joerc configuration file, which could allow local users to gain… vulnerability
  • CVE-2000-0854 When a Microsoft Office 2000 document is launched, the directory of that document is first used to locate DLL's such as riched20.dll and… vulnerability
  • CVE-1999-0690 HP CDE program includes the current directory in root's PATH variable. vulnerability
  • CVE-1999-1461 inpview in InPerson on IRIX 5.3 through IRIX 6.5.10 trusts the PATH environmental variable to find and execute the ttsession program, which… vulnerability
  • CVE-1999-1318 /usr/5bin/su in SunOS 4.1.3 and earlier uses a search path that includes the current working directory (.), which allows local users to… vulnerability

Child of · CWE (1)

  • CWE-668 Exposure of Resource to Wrong Sphere weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-38 Leveraging/Manipulating Configuration File Search Paths attack pattern
  • CAPEC-471 Search Order Hijacking attack pattern

Referenced by CVE · weakness (1,245)

  • CVE-2026-103665 The installer for Yamaha LAN Monitor for Windows provided by Yamaha Corporation may insecurely load Dynamic Link Libraries (DLLs). vulnerability
  • CVE-2026-104349 Creative Cloud Desktop is affected by an Uncontrolled Search Path Element vulnerability that could result in arbitrary code execution in… vulnerability
  • CVE-2026-91093 A potential security vulnerability has been identified in HP One Agent for certain HP PC products, which might allow for escalation of… vulnerability
  • CVE-2026-92202 Luxion KeyShot BIP File Parsing Uncontrolled Search Path Element Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-102438 An uncontrolled search path element vulnerability in ASUS Armoury Crate allows local users to execute arbitrary code with SYSTEM privileges… vulnerability
  • CVE-2026-71170 Dell Application Store, versions prior to 26.05.0.7, contains an Uncontrolled Path Element vulnerability. vulnerability
  • CVE-2026-110936 A vulnerability has been identified in Siemens Software Center (All versions < V4.0.9.8). vulnerability
  • CVE-2026-108390 Hestia Control Panel is a lightweight and powerful control panel for the modern web. vulnerability
  • CVE-2026-103845 Dimension is affected by an Uncontrolled Search Path Element vulnerability that could result in arbitrary code execution in the context of… vulnerability
  • CVE-2026-69923 Uncontrolled search path element in Windows AI allows an authorized attacker to elevate privileges locally. vulnerability
  • CVE-2026-108693 ImageMagick on Windows through 7.1.2-33 and 6.9.13-58 contains an uncontrolled search path vulnerability in NTGhostscriptEXE() that… vulnerability
  • CVE-2026-107615 An uncontrolled search path element vulnerability in GlavSoft TightVNC Server for Windows before 2.8.88 allows a local authenticated user… vulnerability
  • CVE-2026-106186 Uncontrolled search path element in CredentialProvider in Google Chrome on on Windows prior to 155.0.8059.39 allowed a local attacker to… vulnerability
  • CVE-2026-104809 DigitalCanion has discovered a vulnerability that allows an attacker to cause the system to load an attacker-controlled .so file instead of… vulnerability
  • CVE-2026-47570 NVIDIA GPU Display Driver for Windows contains a vulnerability in the CUDA driver where an attacker could cause a library to be loaded from… vulnerability
  • CVE-2026-89325 An uncontrolled search path element in InsightVM assessment content in Rapid7 Insight Agent on Windows allows a local, low-privileged user… vulnerability
  • CVE-2026-6935 IBM Concert 1.0.0 through 3.0.0 invokes operating system commands without fully qualifying executable paths or adequately restricting… vulnerability
  • CVE-2026-91803 A local privilege escalation vulnerability exists in the updater of Foxit PDF Editor/Reader due to unsafe loading of dynamic-link libraries… vulnerability
  • CVE-2026-25264 Privilege escalation due to weak configuration during package extraction process. vulnerability
  • CVE-2026-83598 Netdata is an open source observability tool. vulnerability
  • CVE-2026-54916 NetBox Device Type Library is a collection of community-sourced device type definitions for import into NetBox. vulnerability
  • CVE-2026-56795 Dell Server Update Utility, versions prior to 26.07.01, contains an Uncontrolled Search Path Element vulnerability. vulnerability
  • CVE-2026-92838 A DLL hijacking vulnerability exists in the GeoVision GV-Remote E-Map desktop application. vulnerability
  • CVE-2026-92180 pdfforge PDF Architect activation-service Update Service Uncontrolled Search Path Element Local Privilege Escalation Vulnerability. vulnerability
  • CVE-2026-68955 The installer for Rakuten Kobo Desktop Application (Windows version) insecurely loads Dynamic Link Libraries. vulnerability
  • CVE-2026-87530 Uncontrolled search path element in CredentialProvider in Google Chrome on on Windows prior to 153.0.8010.36 allowed a local attacker to… vulnerability
  • CVE-2026-72980 Uncontrolled search path element in Windows Hello allows an authorized attacker to bypass a security feature locally. vulnerability
  • CVE-2026-76199 Photoshop Desktop is affected by an Uncontrolled Search Path Element vulnerability that could result in arbitrary code execution in the… vulnerability
  • CVE-2026-6958 Acunetix 25.11.251107123 for Windows contains a local privilege escalation vulnerability in the Web Vulnerability Scanning Engine… vulnerability
  • CVE-2026-19590 OpenAI Codex Desktop for Windows and macOS could execute attacker-controlled Git hooks because automated Git operations trusted the… vulnerability
Show all 1,245 ›

Referenced by CWE · peer of (1)

  • CWE-426 Untrusted Search Path weakness

Referenced by OWASP · mapped cwe (1)

  • A08:2025 Software or Data Integrity Failures Top 10 2025