Concepts / Web access and file flaws

Web access and file flaws

Path traversal

Also called local file inclusion, LFI, directory traversal, dot-dot-slash

Reading files outside the intended folder by putting `../` in a filename the server joins onto a path.

Each ../ climbs one folder
Each ../ climbs one folder

The server joins its folder and the name it was sent. Enough ../ steps reach the top of the disk, and the rest of the name walks down to any file.

Path traversal is reading files outside the intended folder by putting ../ in a file name the server joins onto a path. If the server opens pages/<name> without checking the name, ../../../../etc/passwd climbs out of the folder and reads any file the server process can open: password files, keys, configuration. The fix: resolve the path and reject anything outside the folder, or serve only a fixed set of known names.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab