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.
Impact: Gain Privileges or Assume IdentityExecute Unauthorized Code or Commands
There is the potential for arbitrary code execution with privileges of the vulnerable program.
Impact: 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.
Impact: Read Files or Directories
The program could send the output of unauthorized files to the attacker.
Strategy: Attack Surface Reduction
c
/* Raise privileges to those needed for accessing DIR. /
cThe user sets the PATH to reference a directory under the attacker's control, such as "/my/dir/".
The attacker creates a malicious program called "ls", and puts that program in /my/dir
The user executes the program.
When system() is executed, the shell consults the PATH to find the ls program
The program finds the attacker's malicious program, "/my/dir/ls". It doesn't find "/bin/ls" because PATH does not contain "/bin/".
The program executes the attacker's malicious program with the raised privileges.
java//assume getCurrentUser() returns a username that is guaranteed to be alphanumeric (avoiding CWE-78)* $userName = getCurrentUser(); $command = 'ps aux | grep ' . $userName; system($command);
javaHigh