🔐Path Traversal
Also known as Directory Traversal, Dot-Dot-Slash Attack
Adding ../ to a file name to climb out of the folder an app should use.
Think of it like
Think of it like a note that says go back two rooms and bring the safe.
Example
A site shows a picture when you ask for cat.png. An attacker asks for ../../../etc/passwd and gets a server file back instead.
Why it matters
Server files hold passwords, keys and settings. One leaked file can open the whole system.
Definition
Example code
http
GET /view?file=../../../etc/passwd HTTP/1.1
Host: example.comCommon mistake
Key takeaways
- 1Climb with ../. Each one goes a folder up.
- 2Check the final path. It must stay in its folder.
- 3Prefer fixed names. Map each choice to a known file.