<aside>
Path traversal vulnerabilities allow attackers to read arbitrary files on a server running an application.
This can expose:
Consider a shopping application that displays product images. It might load an image using this HTML:
<img src="/loadImage?filename=218.png">
The best defense against path traversal vulnerabilities is to avoid passing user-supplied input to filesystem APIs. Most application functions can be rewritten to achieve the same results more securely.
If you must pass user-supplied input to filesystem APIs, implement these two defensive layers:
Here's a simple Java code example that validates a file's canonical path based on user input:
File file = new File(BASE_DIRECTORY, userInput);
if (file.getCanonicalPath().startsWith(BASE_DIRECTORY)) {
// process file
}
directory-traversal-cheatsheet.txt
</aside>
dirsearch -u TARGET.COM -e php,html,js,asp,xml,csv -w /home/onion/Documents/wordlists/directory-traversal-cheatsheat.txt