Directory traversal
A directory or path traversal consists in exploiting insufficient security validation / sanitization of user-supplied input file names, so that characters representing "traverse to parent directory" are passed through to the file APIs.
Summary
Tools
Basic exploitation
16 bits Unicode encoding
UTF-8 Unicode encoding
Bypass "../" replaced by ""
Bypass "../" with ";"
Double URL encoding
UNC Bypass
NGINX/ALB Bypass
Path Traversal
Interesting Linux files
Interesting Windows files
References
Tools
Basic exploitation
We can use the ..
characters to access the parent directory, the following strings are several encoding that can help you bypass a poorly implemented filter.
16 bits Unicode encoding
UTF-8 Unicode encoding
Bypass "../" replaced by ""
Sometimes you encounter a WAF which remove the "../" characters from the strings, just duplicate them.
Bypass "../" with ";"
Double URL encoding
e.g: Spring MVC Directory Traversal Vulnerability (CVE-2018-1271) with http://localhost:8080/spring-mvc-showcase/resources/%255c%255c..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/windows/win.ini
UNC Bypass
An attacker can inject a Windows UNC share ('\UNC\share\name') into a software system to potentially redirect access to an unintended location or arbitrary file.
NGINX/ALB Bypass
NGINX in certain configurations and ALB can block traversal attacks in the route, For example: http://nginx-server/../../
will return a 400 bad request.
To bypass this behaviour just add forward slashes in front of the url: http://nginx-server////////../../
Java Bypass
Bypass Java's URL protocol
Path Traversal
Interesting Linux files
Interesting Windows files
Always existing file in recent Windows machine. Ideal to test path traversal but nothing much interesting inside...
Interesting files to check out (Extracted from https://github.com/soffensive/windowsblindread)
The following log files are controllable and can be included with an evil payload to achieve a command execution
References
Last updated