What is path traversal?

Definition

Programs that read, write or extract files must ensure the resulting destination remains inside the permitted location. A path supplied by an untrusted file or user can otherwise cross that boundary and affect unrelated files.

The defensive principle is to validate the resolved destination and enforce access boundaries before performing the file operation. Safe failure behavior matters too: malformed input or a failed download should not silently lead to an unauthorized substitute or destination.

ELI5

Imagine a delivery service instructed to leave every parcel in one room. A path-traversal flaw lets a parcel's directions send it into a different room instead.

For example, an archive extractor should reject an entry whose resolved destination is outside the chosen extraction folder rather than writing it elsewhere.

Can archive extraction be affected?

Yes. An extractor must check each resolved destination instead of trusting the archive's stored path.

Is checking only the displayed filename enough?

No. The effective resolved destination and the enforced filesystem permissions determine where an operation can actually occur.

  1. Large white Hidden and Failures with blue App text beside a simple flat blue-and-off-white broken chain on black.
Definition card for path traversal: What is path traversal?

Path traversal is a file-access flaw that allows a program to resolve a requested path outside its intended directory boundary.