Weakness (CWE)
CWE-427: Uncontrolled Search Path Element
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)
-
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.
Source: MITRE CWE-427
319 results · Clear filters · Feed
-
Medium 6.5
Local privilege escalation due to DLL hijacking vulnerability. The following products are affected: Acronis Cyber Prote…
-
Medium 6.7
Uncontrolled search path element in Intel(R) RAID Web Console software for all versions may allow an authenticated user…
-
Medium 5.3
RCE in desktop app in Windows by local attacker
Mattermost Desktop App versions <=5.8.0 fail to specify an absolute path when searching the cmd.exe file, which allows a local attacker who is able to put an cmd.exe file in the Downloads folder of a user's machine to cause remote code execution on that machi…
-
Medium 6.7
An uncontrolled search path in the agent of Ivanti EPM before 2022 SU6, or the 2024 September update allows a local aut…
-
Medium 6.0
gix-path improperly resolves configuration path reported by Git
`gix-path` is a crate of the `gitoxide` project (an implementation of `git` written in Rust) dealing paths and their conversions. Prior to version 0.10.11, `gix-path` runs `git` to find the path of a configuration file associated with the `git` installation, …
-
Medium 6.7
Local privilege escalation due to DLL hijacking vulnerability. The following products are affected: Acronis Snap Deploy…
-
Medium 6.7
Local privilege escalation due to DLL hijacking vulnerability. The following products are affected: Acronis Snap Deploy…
-
Medium 6.7
Uncontrolled search path in some Intel(R) Ethernet Connection I219-LM install software may allow an authenticated user …
-
Medium 6.7
Uncontrolled search path for some Intel(R) oneAPI Compiler software before version 2024.1 may allow an authenticated us…
-
Medium 6.7
Uncontrolled search path for some Intel(R) oneAPI Math Kernel Library software before version 2024.1 may allow an authe…
-
Medium 6.7
Uncontrolled search path in some Intel(R) Distribution for GDB software before version 2024.0.1 may allow an authentica…
-
Medium 6.7
Uncontrolled search path in some Intel(R) FPGA SDK for OpenCL(TM) software technology may allow an authenticated user t…
-
Medium 6.7
Uncontrolled search path in some Intel(R) GPA software before version 2024.1 may allow an authenticated user to potenti…
-
Medium 6.7
Uncontrolled search path element in some installation software for Intel(R) Ethernet Adapter Driver Pack before version…
-
Medium 6.7
Uncontrolled search path in some Intel(R) High Level Synthesis Compiler software before version 23.4 may allow an authe…
-
Medium 6.7
Uncontrolled search path for some Intel(R) IPP Cryptography software before version 2021.11 may allow an authenticated …
-
Medium 6.7
Uncontrolled search path for some Intel(R) MPI Library software before version 2021.12 may allow an authenticated user …
-
Medium 6.7
Uncontrolled search path for some Intel(R) Simics Package Manager software before version 1.8.3 may allow an authentica…
-
Medium 6.7
Uncontrolled search path for some Intel(R) Trace Analyzer and Collector software before version 2022.1 may allow an aut…
-
Medium 6.7
Uncontrolled search path in some EMON software before version 11.44 may allow an authenticated user to potentially enab…
-
Medium 6.7
Uncontrolled search path in some Intel(R) VTune(TM) Profiler software before versions 2024.1 may allow an authenticated…
-
Medium 6.7
Uncontrolled search path for some Intel(R) License Manager for FLEXlm product software before version 11.19.5.0 may all…
-
Medium 6.7
Uncontrolled search path for some Intel(R) Quartus(R) Prime Pro Edition Design Software before version 24.1 may allow a…
-
Medium 6.7
Uncontrolled search path in some Intel(R) IPP software before version 2021.11 may allow an authenticated user to potent…
-
Medium 6.7
Uncontrolled search path for some Intel(R) VROC software before version 8.6.0.1191 may allow an authenticated user to p…
-
Medium 5.5
Okta Verify for Windows is vulnerable to privilege escalation through DLL hijacking. The vulnerability is fixed in Okta…
-
Medium 5.3
Mp3tag DLL tak_deco_lib.dll uncontrolled search path
A vulnerability has been found in Mp3tag up to 3.26d and classified as problematic. This vulnerability affects unknown code in the library tak_deco_lib.dll of the component DLL Handler. The manipulation leads to uncontrolled search path. It is possible to lau…
-
Medium 6.8
gitoxide's gix-path can use a fake program files location
gitoxide An idiomatic, lean, fast & safe pure Rust implementation of Git. `gix-path` can be tricked into running another `git.exe` placed in an untrusted location by a limited user account on Windows systems. Windows permits limited user accounts without admi…
-
Medium 6.6
Zoom Workplace Desktop App for macOS - Uncontrolled Search Path Element
Uncontrolled search path element in the installer for Zoom Workplace Desktop App for macOS before version 6.0.10 may allow an authenticated user to conduct a denial of service via local access.
-
Medium 6.7
Uncontrolled search path in some Intel(R) GPA Framework software before version 2023.3 may allow an authenticated user …
-
Medium 6.7
Uncontrolled search path in some Intel(R) GPA software before version 2023.3 may allow an authenticated user to potenti…
-
Medium 6.7
Uncontrolled search path in Intel(R) Graphics Command Center Service bundled in some Intel(R) Graphics Windows DCH driv…
-
Medium 6.7
Uncontrolled search path in some Libva software maintained by Intel(R) before version 2.20.0 may allow an authenticated…
-
Medium 6.7
Uncontrolled search path for some Intel(R) CST software before version 2.1.10300 may allow an authenticated user to pot…
-
Medium 6.7
Uncontrolled search path in some Intel(R) DSA software uninstallers before version 23.4.39.10 may allow an authenticate…
-
Medium 6.7
Uncontrolled search path element in some Intel(R) VTune(TM) Profiler software before version 2024.0 may allow an authen…
-
Medium 6.7
Uncontrolled search path for some Intel(R) Chipset Device Software before version 10.1.19444.8378 may allow an authenti…
-
Medium 6.7
Uncontrolled search path in some Intel(R) PCM software before version 202311 may allow an authenticated user to potenti…
-
Medium 6.7
Uncontrolled search path for some Intel(R) Distribution for GDB software before version 2024.0 may allow an authenticat…
-
Medium 6.7
Uncontrolled search path in some Intel(R) Inspector software before version 2024.0 may allow an authenticated user to p…