Skip to content
OpenAdvisories

Weakness (CWE)

CWE-427: Uncontrolled Search Path Element

Base Draft

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.

More detail

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.

How to prevent it (5 mitigations)
  1. 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.

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

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

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

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

Source: MITRE CWE-427

952 results · Feed

  • High 7.0

    Captura CRYPTBASE.dll uncontrolled search path

    ** UNSUPPORTED WHEN ASSIGNED ** A vulnerability was found in Captura up to 8.0.0. It has been declared as critical. This vulnerability affects unknown code in the library CRYPTBASE.dll. The manipulation leads to uncontrolled search path. Attacking locally is …

  • Medium 6.7

    PowerPath for Windows, versions 7.0, 7.1 & 7.2 contains DLL Hijacking Vulnerabilities. A regular user (non-admin) can e…

  • Medium 6.7

    Uncontrolled search path in the Intel(R) Trace Analyzer and Collector before version 2020 update 3 may allow an authent…

  • High 7.8

    A maliciously crafted DLL file can be forced to read beyond allocated boundaries in Autodesk InfraWorks 2023, and 2021 …

  • High 7.8

    A DLL Hijacking issue discovered in Soft-o Free Password Manager 1.1.20 allows attackers to create arbitrary DLLs leadi…

  • High 8.8

    Uncontrolled search path in the WULT software maintained by Intel(R) before version 1.0.0 (commit id 592300b) may allow…

  • Medium 6.7

    Uncontrolled search path for the DSP Builder software installer before version 22.4 for Intel(R) FPGAs Pro Edition may …

  • Medium 6.7

    Uncontrolled search path in the Intel(R) Quartus(R) Prime Pro edition software before version 22.3 may allow an authent…

  • Medium 4.2

    Uncontrolled search path in the Intel(R) MacCPUID software before version 3.2 may allow an authenticated user to potent…

  • Medium 6.7

    Uncontrolled search path in some Intel(R) NUC Chaco Canyon BIOS update software before version iFlashV Windows 5.13.00.…

  • Medium 6.7

    Uncontrolled search path in the Intel(R) Unite(R) Plugin SDK before version 4.2 may allow an authenticated user to pote…

  • Medium 6.7

    Uncontrolled search path in some Intel(R) oneAPI Toolkit and component software installers before version 4.3.0.251 may…

  • Medium 6.7

    Uncontrolled search path in the Intel(R) DCM software before version 5.1 may allow an authenticated user to potentially…

  • Medium 6.7

    Uncontrolled search path for the Intel(R) NUC Pro Software Suite before version 2.0.0.3 may allow an authenticated user…

  • Medium 6.7

    Uncontrolled search path for the Intel(R) HDMI Firmware Update tool for NUC before version 1.79.1.1 may allow an authen…

  • Medium 6.7

    Uncontrolled search path in some Intel(R) Pathfinder for RISC-V software may allow an authenticated user to potentially…

  • Medium 6.7

    Uncontrolled search path element in the HotKey Services for some Intel(R) NUC P14E Laptop Element software for Windows …

  • Medium 6.7

    Uncontrolled search path element in the Intel(R) VTune(TM) Profiler software before version 2023.0 may allow an authent…

  • High 7.8

    CyberGhostVPN Windows Client before v8.3.10.10015 was discovered to contain a DLL injection vulnerability via the compo…

  • Medium 6.7

    Local privilege escalation due to a DLL hijacking vulnerability. The following products are affected: Acronis Snap Depl…

  • High 7.3

    Git CMD erroneously executes `doskey.exe` in the current directory, if it exists

    Git for Windows is the Windows port of Git. Prior to version 2.40.1, any user of Git CMD who starts the command in an untrusted directory is impacted by an Uncontrolles Search Path Element vulnerability. Maliciously-placed `doskey.exe` would be executed silen…

  • High 7.6

    Git for Windows's config file of `connect.exe` is susceptible to malicious placing

    Git for Windows, the Windows port of Git, ships with an executable called `connect.exe`, which implements a SOCKS5 proxy that can be used to connect e.g. to SSH servers via proxies when certain ports are blocked for outgoing connections. The location of `conn…

  • Medium 6.3

    A CWE-427 - Uncontrolled Search Path Element vulnerability exists that could allow an attacker with a local privileged …

  • Medium 6.7

    Executable Hijacking

    An Executable Hijacking condition exists in the Qualys Cloud Agent for Windows platform in versions before 4.5.3.1. Attackers may load a malicious copy of a Dependency Link Library (DLL) via a local attack vector instead of the DLL that the application was ex…

  • Medium 6.7

    DLL Hijacking vulnerability in SapSetup (Software Installation Program)

    A Windows user with basic user authorization can exploit a DLL hijacking attack in SapSetup (Software Installation Program) - version 9.0, resulting in a privilege escalation running code as administrator of the very same Windows PC. A successful attack depen…

  • Medium 5.3

    KMPlayer SHFOLDER.dll uncontrolled search path

    A vulnerability, which was classified as problematic, has been found in KMPlayer 4.2.2.73. This issue affects some unknown processing in the library SHFOLDER.dll. The manipulation leads to uncontrolled search path. Attacking locally is a requirement. The expl…

  • High 8.8

    Local Elevation of Privilege in M-Files

    Elevation of privilege issue in M-Files Installer versions before 22.6 on Windows allows user to gain SYSTEM privileges via DLL hijacking.

  • High 7.8

    This vulnerability allows remote attackers to execute arbitrary code on affected installations of AVEVA Edge 2020 SP2 P…

  • High 7.8

    This vulnerability allows remote attackers to execute arbitrary code on affected installations of AVEVA Edge 2020 SP2 P…

  • High 7.8

    This vulnerability allows remote attackers to execute arbitrary code on affected installations of AVEVA Edge 2020 SP2 P…

  • High 7.8

    Local Privilege Escalation in Zoom for macOS Installers

    Zoom Client for IT Admin macOS installers before version 5.13.5 contain a local privilege escalation vulnerability. A local low-privileged user could exploit this vulnerability in an attack chain during the installation process to escalate their privileges to…

  • High 7.8

    Apache OpenOffice: Empty entry in Java class path

    Apache OpenOffice versions before 4.1.14 may be configured to add an empty entry to the Java class path. This may lead to run arbitrary Java code from the current directory.

  • High 7.8

    An issue was discovered in Veritas NetBackup before 10.0 on Windows. A vulnerability in the way the client validates th…

  • High 7.8

    ONLYOFFICE Docs through 7.3 on certain Linux distributions allows local users to gain privileges via a Trojan horse lib…

  • High 7.8

    An issue found in UwAmp v.1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.2.1, 3.0.0, 3.0.1, 3.0.2 allows a remote attacker to execute …

  • High 8.8

    A vulnerability was reported where through modifying the scan variables, an authenticated user in Tenable products, tha…

  • Medium 5.5

    McAfee Total Protection prior to 16.0.49 allows attackers to elevate user privileges due to DLL sideloading. This could…

  • Medium 6.7

    An issue in the Trend Micro Apex One agent could allow an attacker who has previously acquired administrative rights vi…

  • Critical 9.8

    An uncontrolled search path element vulnerability in the Trend Micro Apex One Server installer could allow an attacker …

  • High 8.8

    Uncontrolled search path element vulnerability exists in pg_ivm versions prior to 1.5.1. When refreshing an IMMV, pg_iv…