Code on a screen, representing directory traversal.

Escaping a folder to reach files you should not.

What directory traversal is

Directory traversal is a web security vulnerability in which an attacker manipulates file paths to access files and directories that are outside the intended folder. Applications that serve or read files based on user input can be vulnerable if they do not carefully restrict which paths are allowed. By crafting a path that navigates outside the expected location, an attacker can reach files they should not.

How the attack works

Directory traversal works by supplying a file path that climbs out of the intended directory to somewhere else in the file system. If an application builds a file path from user input without proper checks, an attacker can include navigation that moves up and out of the allowed folder. The application then accesses a file outside the intended area, exposing it to the attacker.

What an attacker can reach

Through directory traversal, an attacker may be able to read files that were never meant to be accessible, potentially including sensitive configuration or system files. Because the attack escapes the boundary the application intended, it can expose information outside the normal scope of the application. The severity depends on what files become reachable, but it can be significant.

Why path handling matters

The root cause of directory traversal is trusting user-supplied path information without restricting it to the intended location. When an application lets input dictate the file path freely, it opens the door to escaping the intended directory. This is why careful handling of file paths - ensuring they stay within the allowed boundaries - is central to preventing the vulnerability.

Preventing directory traversal

Preventing directory traversal involves validating and constraining the file paths an application uses based on user input, so they cannot escape the intended directory. By ensuring that requests can only reach files within the permitted area, applications block attempts to traverse elsewhere. Keeping file access confined to where it belongs is the main defense against this attack.

Why it matters

Directory traversal is an important web security vulnerability to understand. Knowing what it is - manipulating file paths to reach files outside the intended folder - clarifies why careful handling of file paths matters. For anyone interested in web security, it is a valuable concept to understand.

See also: What is a file system? Explained, What is SQL injection? Explained.

Sources

Published date reflects the original event date (2026-06-16). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.

Skillo Staff

Skillo Staff

All stories by: Skillo Staff

Leave a Reply