CWE-426 / WEAKNESS
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.
- Category
- CWE weaknesses
- Version / scope
- CWE 5.0; release 2026-10-28; publisher status Stable
- Affected / relevant technologies
- Not Language-Specific / Python
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
Review publisher context and local applicability; this reference is not execution evidence.
Potential impact
Integrity Confidentiality Availability Access Control Gain Privileges or Assume Identity Execute Unauthorized Code or Commands There is the potential for arbitrary code execution with privileges of the vulnerable program. If the product uses a search path to locate critical resources such as programs or libraries, then an attacker could modify that search path to point to a malicious program/library, which the targeted product would then execute. Availability DoS: Crash, Exit, or Restart The program could be redirected to the wrong files, potentially triggering a crash or hang when the targeted file is too large or does not have the expected format. Confidentiality Read Files or Directories The program could access unauthorized data and send the output of unauthorized files to the attacker. Other Varies by Context The problem extends to any type of critical resource that the product trusts. For example, the attacker could modify configuration in unexpected ways.
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: MITRE. Release: CWE 5.0. Source checked: 2026-11-26.
Source object: CWE-426. Object modified: 2026-10-28.
Attribution and source terms (© The MITRE Corporation; reproduced with permission)Detection and investigation
- Black Box Use monitoring tools that examine the software's process as it interacts with the operating system and the network. This technique is useful in cases when source code is unavailable, if the software was not developed by you, or if you want to verify that the build phase did not introduce any new weaknesses. Examples include debuggers that directly attach to the running process; system-call tracing utilities such as truss (Solaris) and strace (Linux); system activity monitors such as FileMon, RegMon, Process Monitor, and other Sysinternals utilities (Windows); and sniffers and protocol analyzers that monitor network traffic. Attach the monitor to the process and look for library functions and system calls that suggest when a search path is being used. One pattern is when the program performs multiple accesses of the same file but in different directories, with repeated failures until the proper filename is found. Library calls such as getenv() or their equivalent can be checked to see if any path-related variables are being accessed.
- 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.) High
- Manual Analysis Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- Architecture and Design Implementation Attack Surface Reduction 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.
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Publisher weakness and attack-pattern relationships
These relationships retain the publisher's source attributes and view context; they do not establish that an attack or weakness applies to a particular system.
- CAPEC-38 → Related_Weakness → CWE-426 Open related reference
- CWE-426 → Related_Attack_Pattern → CAPEC-38 Open related reference
- CWE-426 → PeerOf → CWE-427 Open related reference
- CWE-426 → PeerOf → CWE-428 Open related reference
- CWE-426 → ChildOf → CWE-642 Open related reference
- CWE-426 → ChildOf → CWE-668 Open related reference
- CWE-426 → ChildOf → CWE-673 Open related reference
- CWE-98 → CanAlsoBe → CWE-426 Open related reference
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- https://cwe.mitre.org/data/definitions/426.html — Publisher link; not separately HTTP-checked
- MITRE CWE 5.0 source snapshot — source accessed 2026-11-26
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
