Directory Traversal (also known as Path Traversal) is a security vulnerability in web applications that allows an attacker to access files or directories outside the intended directory. The attacker manipulates file paths to navigate through the server’s filesystem.
A vulnerable web application often processes file paths directly from user input, such as an URL:
https://example.com/getFile?file=report.pdf
If the server does not properly validate the input, an attacker could modify it like this:
https://example.com/getFile?file=../../../../etc/passwd
Here, the attacker uses ../
(parent directory notation) to move up the directory structure and access system files like /etc/passwd
(on Linux).