HackPath Academy

Web Application Hacking (Hands-On)

Path Traversal / LFI — Concept + Live Lab

Escape a folder with ../ to read arbitrary files off the server.

Intermediate · 16 min · Hands-on lab

Open the interactive lesson & lab →

Path traversal (a.k.a. directory traversal, and closely tied to Local File Inclusion) happens when an app builds a file path from user input without sanitising it. By injecting ../ sequences you climb out of the intended directory and read files anywhere the app's user can.

A file viewer might do:

$file = $_GET['file'];
include('/var/www/html/pages/' . $file);

Request ?file=../../../../etc/passwd and the path resolves outside 'pages' to /etc/passwd. Each ../ goes up one directory; you need enough to reach the root, then walk back down to your target.

High-value targets

Take the quiz and try the live lab →