This vulnerability occurs when an application builds a file path using user input but fails to properly block directory traversal sequences like '/dir/../filename'. This allows an attacker to break out of the intended restricted directory and access files or folders elsewhere on the system.
Attackers exploit this weakness to navigate the server's file system and read, write, or delete sensitive files outside the application's allowed directory. This is a classic path traversal attack, but the specific '/dir/../filename' pattern is often used to bypass simple security filters that only check for '../' at the very beginning of the input string. Developers can prevent this by using strong, canonical path validation. Instead of just checking for '..', your code should resolve the entire input path to its absolute, canonical form and then verify it remains strictly within the intended base directory. Relying on built-in language APIs for path normalization and sandboxing is far safer than trying to manually filter out specific sequences.
Impact: Read Files or DirectoriesModify Files or Directories
Strategy: Input Validation
Strategy: Input Validation