Directory traversal
An attack that manipulates a file path in a request, commonly with ../ sequences, to make an application read or write files outside the directory it is meant to use.
Directory traversal, also called path traversal, abuses an application that builds a file path from user input. By supplying sequences such as ../, often encoded to slip past filters, an attacker climbs out of the intended folder and reaches files elsewhere on the server, such as configuration files, credentials or /etc/passwd. It is catalogued as CWE-22, and the OWASP Top 10 (2025 edition) maps it under Broken Access Control.
The flaw is a failure of input validation and of access control together. Stronger designs avoid passing user input into file system calls at all, for example by mapping a user’s choice to an identifier held on the server. Where a path has to be built, the application canonicalises it (resolving ../ sequences and encodings) and then checks that the result still sits inside the permitted base directory. Allowlisting file names, running the application with least privilege so it has no access to sensitive system files, and sandboxing limit the damage if a check fails. Filtering the literal string ../ is weak, because encodings can bypass it.
Exam relevance: a scenario showing ../ sequences in a URL or file parameter is likely to point to directory traversal. Candidates are expected to recognise canonicalisation followed by a base-directory check, together with least privilege, as stronger answers than simple character filtering.