Knowledge Base · general

Path Traversal

generaltechnique notetechniquepath-traversal

Escaping a base directory with ../ (or absolute paths) to read arbitrary files.

How it works

  • ../../../../etc/passwd against file-serving endpoints.
  • Filter bypasses: double URL-encoding (..%252f), nested sequences, and path normalisation differences between filter and sink.
  • Target sources of interest: service.py, /proc/self/cmdline, environment files, planted flag files.

Detection & defence

  • Canonicalise the path and require it to stay inside an allow-listed directory.
  • Serve files by opaque ID from a database rather than by user-supplied name.