Case BB5C80 · Web AppSec · L1 Foundations

Path Traversal

Practise as: Explain itLevel: L1 Foundations
  1. 01 What is it?
  2. 02 How is it abused?
  3. 03 How do you stop it?
What a strong answer covers

Try it out loud first. Then check yourself:

  1. User input used in a file path escapes the intended folder with ../ sequences, e.g. ?file=../../etc/passwd
  2. Filters are bypassed with URL or double encoding, absolute paths, and backslashes on Windows; reads can expose config and keys
  3. Zip Slip: archive entries named ../../app/x.jsp write outside the extract folder, turning traversal into code execution
  4. Best fix: never pass user input to the filesystem; map an ID to a server-side path or use an allowlist of names
  5. Otherwise canonicalize (realpath) then verify the result still starts with the base directory, and run with least privilege

If the interviewer pushes back

  • Why is stripping ../ from the input before use not a safe fix?
  • How does path traversal differ from local file inclusion in PHP, and when does LFI become RCE?

Go deeper

More Web AppSec cards

All Web AppSec cards →

cardosec draws a security topic and gives you a clock: explain it out loud with no notes, then see what you covered and what you missed. Free during early access.

Reviewed 2026-10-09