This vulnerability occurs when an application builds a file path using user input but fails to properly validate it, allowing an attacker to break out of the intended directory and access files or folders anywhere on the server.

Path traversal, often called directory traversal, happens because applications don't properly filter special directory navigation sequences. Attackers exploit this by injecting sequences like '../' (which moves up one directory level) or using absolute paths (like /etc/passwd) to trick the application into reading or writing files outside its designated safe folder. This flaw is typically found in file upload, download, or viewing features. To prevent it, developers must implement strict input validation, use a whitelist of allowed characters, and employ security mechanisms like canonicalizing paths before checking them against a permitted directory list.
Impact: Execute Unauthorized Code or Commands
The attacker may be able to create or overwrite critical files that are used to execute code, such as programs or libraries.
Impact: Modify Files or Directories
The attacker may be able to overwrite or create critical files, such as programs, libraries, or important data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, appending a new account at the end of a password file may allow an attacker to bypass authentication.
Impact: Read Files or Directories
The attacker may be able read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file, the attacker could conduct brute force password guessing attacks in order to break into an account on the system.
Impact: DoS: Crash, Exit, or Restart
The attacker may be able to overwrite, delete, or corrupt unexpected critical files such as programs, libraries, or important data. This may prevent the product from working at all and in the case of protection mechanisms such as authentication, it has the potential to lock out product users.
Strategy: Input Validation
Strategy: Input Validation
Strategy: Libraries or Frameworks
Strategy: Firewall
Effectiveness: Moderate
Strategy: Environment Hardening
Strategy: Enforcement by Conversion
Strategy: Sandbox or Jail
Effectiveness: Limited
Strategy: Attack Surface Reduction
Strategy: Environment Hardening
perlbashbashbashjavaperlbashbashbashjavabashhtmljavapythonpythonHigh