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

949 results · Feed

  • High 7.3

    Mullvad VPN for macOS: Local Privilege Escalation via unverified bundle path in installer

    Mullvad VPN is a VPN client app for desktop and mobile. When using macOS with versions 2026.1 and below, Mullvad VPN may allow local privilege escalation during installation or upgrade. The installer package executes binaries from /Applications/Mullvad VPN.ap…

  • High 7.8

    Claude HUD 0.0.12 Arbitrary Command Execution via COMSPEC Environment Variable

    Claude HUD through 0.0.12, patched in commit 234d9aa, contains a command injection vulnerability that allows local attackers to execute arbitrary commands by manipulating the COMSPEC environment variable. Attackers can set COMSPEC to an arbitrary binary path …

  • High 7.0

    A DLL hijacking vulnerability in the AMD Cleanup Utility could allow an attacker to achieve privilege escalation potent…

  • High 8.5

    Metasploit Pro on Windows: Local Privilege Escalation via OpenSSL Configuration File Loading

    Rapid7 Metasploit Pro is vulnerable to a local privilege escalation attack that allows a user to gain SYSTEM level control of a Windows host. When started the metasploitPostgreSQL service would start the postgres.exe child process which would in turn load an …

  • High 7.0

    Unsafe OpenSSL initialization within some AMD optional tools may allow a local user-privileged attacker to inject a mal…

  • Medium 5.2

    Privilege escalation via mk_mysql agent plugin on Windows

    Privilege escalation in the mk_mysql agent plugin on Windows in Checkmk <2.4.0p29, <2.3.0p47, and 2.2.0 (EOL) allows a local unprivileged user able to create a Windows service whose name matches 'MySQL' or 'MariaDB' (or with write access to a binary reference…

  • High 7.8

    Bytello Share (Windows Edition) installer executable provided by Bytello insecurely loads Dynamic Link Libraries. If th…

  • Medium 5.4

    Uncontrolled search path for some AI Playground software before version 3.0.0 alpha within Ring 3: User Applications ma…

  • Medium 5.4

    Uncontrolled search path for some Intel(R) Server Firmware Update Utility Software before version 16.0.12. within Ring …

  • Medium 5.4

    Uncontrolled search path for some Intel(R) Connectivity Performance Suite software installers before version 50.25.1121…

  • High 7.8

    OpenClaw < 2026.4.23 - Arbitrary Code Execution via setup-api.js in Current Working Directory

    OpenClaw before 2026.4.23 contains an arbitrary code execution vulnerability in the bundled plugin setup resolver that loads setup-api.js from process.cwd() during provider setup metadata resolution. Attackers can execute arbitrary JavaScript under the curren…

  • Medium 5.0

    OpenClaw < 2026.4.22 - Connector Endpoint Host Override via Workspace dotenv Files

    OpenClaw before 2026.4.22 allows workspace dotenv files to override connector endpoint hosts for Matrix, Mattermost, IRC, and Synology connectors. Attackers with workspace access can redirect runtime traffic to malicious endpoints by setting endpoint variable…

  • High 7.3

    OpenClaw < 2026.4.20 - Arbitrary Code Execution via MCP stdio Environment Variables

    OpenClaw before 2026.4.20 contains an improper environment variable validation vulnerability in MCP stdio server configuration that allows attackers to execute arbitrary code. Malicious workspace configurations can pass dangerous startup variables like NODE_O…

  • Critical 9.8
    CVE-2025-69599 Public exploit

    RayVentory Scan Engine through 12.6 Update 8 allows attackers to gain privileges if they control the value of the PATH …

  • Medium 5.7

    DLL Hijacking Vulnerability in ZTE Cloud PC Client uSmartview

    ZTE Cloud PC client uSmartView contains a DLL hijacking vulnerability; since uSmartViewServiceAgent.exe runs with SYSTEM privileges, successful hijacking enables local arbitrary code execution, privilege escalation, and memory corruption.contains a DLL hijack…

  • Medium 5.5

    openssl.cnf Privilege Escalation Vulnerability in ZTE Cloud PC Client uSmartview

    There exists an openssl.cnf privilege escalation vulnerability in ZTE Cloud PC client uSmartview. An attacker can execute arbitrary code locally and escalate privileges.

  • High 8.4

    AC2000 Uncontrolled Search Path Element

    An Uncontrolled Search Path Element vulnerability in JohnsonControls AC2000 on Windows allows Leveraging/Manipulating Configuration File Search Paths. This issue affects AC2000: from 10.6 before release 10, from 11.0 before release 9, from 12 before release 3.

  • High 8.5

    Uncontrolled search path in PluginLauncher allows SYSTEM code execution in WatchGuard Agent

    Uncontrolled Search Path Element vulnerability in WatchGuard Agent on Windows allows Using Malicious Files.

  • Medium 6.7

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

  • Medium 6.1

    OpenClaw < 2026.3.31 - Compiler Binary Substitution via Environment Variable Override in Host Execution Policy

    OpenClaw before 2026.3.31 contains an incomplete host-env-security-policy.json that fails to restrict compiler binary environment variables, allowing untrusted models to substitute CC, CXX, CARGO_BUILD_RUSTC, and CMAKE_C_COMPILER via environment overrides. At…

  • High 7.8

    eMPIA Technology|AVACAST - DLL Hijacking

    AVACAST developed by eMPIA Technology, has a DLL Hijacking vulnerability, allowing authenticated local attackers to place a malicious DLL in a specific directory, resulting in arbitrary code execution with system privileges when the system loads the DLL.

  • High 7.8

    NSIS (Nullsoft Scriptable Install System) 3.06.1 before 3.12 sometimes uses the Low IL temp directory when executing as…

  • High 8.0

    Microsoft Power Apps Remote Code Execution Vulnerability

    Uncontrolled search path element in Microsoft Power Apps allows an unauthorized attacker to execute code over a network.

  • Medium 5.1

    DLL Hijacking in EfficientLab Controlio Leads to Local Privilege Escalation

    EfficientLab Controlio before v1.3.95 contains a DLL hijacking vulnerability caused by weak folder permissions in the installation directory. A local attacker can place a specially crafted DLL in this directory and achieve arbitrary code execution with highes…

  • High 7.3

    IP Setting Software contains an issue with the DLL search path, which may lead to insecurely loading Dynamic Link Libra…

  • High 7.8

    The installers of LiveOn Meet Client for Windows (Downloader5Installer.exe and Downloader5InstallerForAdmin.exe) and th…

  • Critical 10.0

    Firebird: Path Traversal + Arbitrary File Write Leads to Remote Code Execution

    Firebird is an open-source relational database management system. In versions prior to 5.0.4, 4.0.7 and 3.0.14, the external engine plugin loader concatenates a user-supplied engine name into a filesystem path without filtering path separators or .. component…

  • High 7.0
    CVE-2026-6421 Public exploit

    Mobatek MobaXterm Home Edition msimg32.dll uncontrolled search path

    A vulnerability has been found in Mobatek MobaXterm Home Edition up to 26.1. This affects an unknown part in the library msimg32.dll. The manipulation leads to uncontrolled search path. An attack has to be approached locally. The attack is considered to have …

  • High 7.8

    Eaton Intelligent Power Protector (IPP) is affected by insecure library loading in its executable, which could lead to …

  • High 8.6

    Photoshop Installer | CWE-427: Uncontrolled Search Path Element

    Adobe Photoshop Installer was affected by an Uncontrolled Search Path Element vulnerability that could have resulted in arbitrary code execution in the context of the current user. An attacker could have exploited this vulnerability by placing a malicious lib…

  • High 7.3

    During an internal security assessment, a potential vulnerability was discovered in Lenovo Software Fix, that during in…

  • Medium 6.7

    A potential DLL hijacking vulnerability was reported in Lenovo Service Bridge that, under certain conditions, could all…

  • High 7.8

    Vulnerability Related to an Uncontrolled Search Path Element in a UPS Management Application

    It has been identified that a vulnerability (CWE-427) exists in the UPS (Uninterruptible Power Supply) management application, whereby improper permissions on the installation directory allow a malicious actor to place a DLL that is then executed with adminis…

  • High 7.3

    KeePassXC OpenSSL Configuration Uncontrolled Search Path Element Local Privilege Escalation Vulnerability

    KeePassXC OpenSSL Configuration Uncontrolled Search Path Element Local Privilege Escalation Vulnerability. This vulnerability allows local attackers to escalate privileges on affected installations of KeePassXC. An attacker must first obtain the ability to ex…

  • High 7.8

    NoMachine Uncontrolled Search Path Element Local Privilege Escalation Vulnerability

    NoMachine Uncontrolled Search Path Element Local Privilege Escalation Vulnerability. This vulnerability allows local attackers to escalate privileges on affected installations of NoMachine. An attacker must first obtain the ability to execute low-privileged c…

  • High 7.8

    Emocheck insecurely loads Dynamic Link Libraries (DLLs). If a crafted DLL file is placed to the same directory, an arbi…

  • High 8.8

    A Dynamic-link Library Injection vulnerability in GatewayGeo MapServer for Windows version 5 allows attackers to escala…

  • High 7.8

    MemProcFS < 5.17 DLL/Shared Library Hijacking

    MemProcFS before 5.17 contains multiple unsafe library-loading patterns that enable DLL and shared-library hijacking across six attack surfaces, including bare-name LoadLibraryU and dlopen calls without path qualification for vmmpyc, libMSCompression, and plu…

  • High 7.8

    Libssh: libssh: insecure default configuration leads to local man-in-the-middle attacks on windows

    A flaw was found in libssh. This vulnerability allows local man-in-the-middle attacks, security downgrades of SSH (Secure Shell) connections, and manipulation of trusted host information, posing a significant risk to the confidentiality, integrity, and availa…

  • Medium 6.7

    Local privilege escalation due to DLL hijacking vulnerability. The following products are affected: Acronis True Image …