This vulnerability occurs when an application builds file paths using user-supplied input without properly validating or sanitizing it. Attackers can exploit this by inserting special directory traversal sequences like '..' to access files and directories outside the intended restricted folder.

Path traversal, often called directory traversal, is a critical security flaw where an attacker manipulates file path inputs to break out of the application's intended directory. By using sequences like '../' (or its encoded equivalents), they can navigate to sensitive system files, configuration files, source code, or other restricted data. This typically happens when file operations—such as reading, writing, or deleting—rely on unsanitized user input from URLs, form fields, or cookies to construct the final path. To prevent this, developers must implement strict validation using allowlists of permitted files or directories, rather than trying to block malicious patterns. All user input used in file system operations should be canonicalized and then checked against a base directory path to ensure the final resolved path stays within the intended safe location. Server configuration should also enforce proper permissions, limiting the application's access to only necessary directories.
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 by traversing the file system to access files or directories that are outside of the restricted directory. 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 a protection mechanisms such as authentication, it has the potential to lockout every user of the product.
Strategy: Input Validation
Strategy: Input Validation
Strategy: Firewall
Effectiveness: Moderate
otherotherperlbashbashbashhtmljava