thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Intermediate

Path Traversal Prevention

Defenses that stop user input from accessing files outside an intended directory.

Definition

Best practices are avoiding user input in file paths, using indirect identifiers mapped to files, canonicalizing the path and verifying it stays within the base directory, allowlisting filenames and running with least-privileged file permissions or chroot.

Example

The app resolves the full real path and rejects it unless it starts with /srv/app/files/.

Exam tip

Canonicalize then check the prefix; string filters for ../ are bypassable.

Related terms