CWE-426: Untrusted Search Path
The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.
This might allow attackers to execute their own programs, access unauthorized data files, or modify configuration in unexpected ways. If the product uses a search path to locate critical resources such as programs, then an attacker could modify that search path to point to a malicious program, which the targeted product would then execute. The problem extends to any type of critical resource that the product trusts. Some of the most common variants of untrusted search path are: In various UNIX and Linux-based systems, the PATH environment variable may be consulted to locate executable programs, and LD_PRELOAD may be used to locate a separate library. In various Microsoft-based systems, the PATH environment variable is consulted to locate a DLL, if the DLL is not found in other paths that appear earlier in the search order.
Consequences
- Integrity, Confidentiality, Availability, Access Control: Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands
- Availability: DoS: Crash, Exit, or Restart
- Confidentiality: Read Files or Directories
How to prevent it
- 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.
- 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 it, while execl() and execv() require a full path.
Recent advisories
- GHSA-6hwm-xvph-95vm — NLTK: Uncontrolled search path when invoking the Graphviz 'dot' binary
- GHSA-hxmv-c4g6-5fqc — PraisonAI workflow include bypasses tools.py autoload opt-in and executes included recipe code
- GHSA-rx78-29qr-5hq8 — OpenClaw: Workspace-derived service PATH could influence trash command selection
- GHSA-wc84-j36w-pw4x — OpenClaw: Workspace .env STATE_DIRECTORY could influence bundled runtime dependency roots
- GHSA-24vr-rprv-67rf — OpenClaw: Workspace .env npm_execpath could influence bundled runtime dependency install
- GHSA-fq9j-vw4w-fr6v — OpenClaw: Workspace .env CLOUDSDK_PYTHON could influence Gmail setup gcloud execution
- GHSA-8wg3-5mcm-fjq8 — OpenClaw: Workspace .env could override Homebrew executable selection for skill install flows
- GHSA-mh5c-xrmh-m794 — uutils coreutils has an Untrusted Search Path
- GHSA-5cwg-9f6j-9jvx — Claude Code: Insecure System-Wide Configuration Loading Enables Local Privilege Escalation on Windows
- GHSA-g985-wjh9-qxxc — PraisonAI Vulnerable to RCE via Automatic tools.py Import
- GHSA-2g3w-cpc4-chr4 — PraisonAI Vulnerable to Implicit Execution of Arbitrary Code via Automatic `tools.py` Loading
- GHSA-hfvc-g4fc-pqhx — opentelemetry-go: BSD kenv command not using absolute path enables PATH hijacking
- GHSA-vfw7-6rhc-6xxg — OpenClaw Has Incomplete Fix for CVE-2026-4039: CLI Backend Environment Variable Injection via Workspace Config
- GHSA-8rh7-6779-cjqq — OpenClaw has a CWD `.env` environment variable injection which bypasses host-env policy and allows config takeover
- GHSA-j48q-4c78-rhf9 — openssl-encrypt: Dynamic .so loading for Whirlpool uses broad glob pattern without integrity verification
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor