Skip to content

Bug class · Intermediate

Path traversal and file inclusion

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

median public bounty
$1,500

Covers CWE 22, 23, 35, 73, 98.

How it works

Full lesson

The pattern behind every report in this class.

Path traversal and file inclusion are the same underlying mistake seen from two angles: a program takes a path or filename from the user and uses it in a file operation without confirming the result stays inside the directory it meant to use. Traversal is the read, write or delete of a file outside that directory; inclusion is the loading of a local file into the running code, often a template, language file or plugin. The evidence covers 1809 reports, 1565 with summaries and 86 paid, so this is a large, well-trodden class rather than a niche one.

Programs care because the consequences are rarely limited to one file. The same flaw turns up in download endpoints, archive extraction, upload handlers, deletion and cleanup routines, and template resolution, and hunters repeatedly chained it to credential disclosure, code execution and full compromise. Reports show traversal reaching runtime logs and configuration files holding plain text credentials and cloud keys, and archive writes landing in startup or autorun locations.

It is most often found wherever a filename or path parameter exists: enterprise download and file-serving actions, AI and ML tooling endpoints for file read, write and delete, Node.js static file servers, VPN portals, SCADA and industrial software, WordPress plugins, and archive extraction for zip, tar, CAB and EPUB. The common thread is a feature that was built to handle files and trusted its input.

The concept is simple. A feature needs a file, so it takes a name or path from the request and joins it onto a base directory. If the input contains parent-directory segments, an absolute path, or a link that points elsewhere, the joined result resolves outside the base. The program then reads, writes, deletes or includes whatever the resolved path names. Nothing exotic is required; the flaw is the absence of a check after resolution.

Things to try

All 1,547

Each line worked in a disclosed report. Test only what a program's scope allows.

Download and file-read endpoints 220

  • Send a request to a file-handling endpoint with a path that climbs out of the intended directory and check whether the server returns a file listing or file contents instead of an error.
  • Test a web application's file parameters with relative path traversal sequences to read files outside the intended directory.
  • Request a traversal path from a file-serving endpoint and check whether the system password file comes back.
  • As an authenticated user, send a traversal path to the ColdFusion application server endpoint to disclose or delete sensitive files.

File write, copy and delete operations 190

  • Use a configuration export or save method with a traversal path to write files to arbitrary locations.
  • Send a traversal path to a network config save method and check whether arbitrary files can be overwritten.
  • Send a traversal path to a static config save method and check whether files can be written and code executed.
  • Craft a source path using forward slashes in an auto-update flow and check whether a file is written outside the temporary installer folder.

Desktop and mobile applications 177

  • Build an archive whose entry names contain traversal sequences or absolute paths and open it in the desktop application to see whether files land outside the extraction folder.
  • Craft a ZIP whose entry names contain parent-directory segments and open it in a desktop archive viewer to see whether files land outside the extraction folder.
  • Package a project as a ZIP with an entry containing traversal sequences, open it in the desktop tool, and check whether a configuration file is written to the user's home directory.
  • Restore a crafted backup file in a mobile books app and check whether protected system files can be modified.

Encoding and sanitiser bypasses 108

  • Bypass the archive path filter using double URL encoding in entry names and check whether the filter still catches it.
  • Submit an archive with backslash traversal sequences to a package validator that only blocks forward slashes and check for writes outside the directory.
  • Send percent-encoded traversal sequences to a loader that checks the path before decoding it.
  • Try a file extension with a trailing space to slip past an extension blocklist.

Archive extraction and zip-slip 104

  • Upload or submit an archive containing entries with traversal sequences or symlinks and check whether files are written outside the extraction directory.
  • Upload or supply a ZIP or TAR archive whose entry names contain parent-directory segments and check whether files land outside the extraction directory.
  • Open a crafted archive whose entry paths traverse out of the extraction folder and check for writes to startup or system directories.
  • Upload an archive whose entry names contain parent-directory segments and check whether files land outside the extraction folder.

Bypasses and variations

All 193
  • Bypass the existing authentication mechanism before reaching the traversal method.
  • Symbolic and hard links inside archives were used to write outside the extraction directory.
  • Craft an entry name that begins with the destination directory name so a prefix check without a trailing slash passes and the file lands in a sibling directory.
  • Only some path parameters were sanitised, so the unsanitised working-directory parameter was the way around the filter.
  • Use double URL encoding to bypass path filtering.
  • Prefix a path with a trusted directory and then use parent-directory segments to reach an untrusted location, defeating a raw string prefix check.

Typical fixes

All 98
  • Resolve the final path and confirm it stays inside the intended directory before any read, write or delete.
  • Reject archive entries whose names contain traversal sequences or absolute paths before extraction.
  • Detect symlink entries correctly and check the resolved target stays inside the extraction directory before writing or deleting.
  • Validate that each archive entry path resolves inside the intended extraction directory before writing.
  • Use an allow-list of permitted modules or files instead of passing request values into includes.
  • Improve handling and validation of symbolic links before file operations and during restore.

Tips for beginners

All 15
  • Start with features that obviously handle files: download endpoints taking a filename or path parameter, upload and import handlers, archive extraction, deletion and cleanup routines, and template or language resolution. These are where the evidence concentrates, and a single parameter is often enough to begin.
  • Change one parameter at a time from a normal filename to a traversal sequence and compare status, content type and body against the normal request. A response that returns a file listing or file contents instead of an error is the signal. Then request a known sensitive file to confirm the traversal reaches outside the intended folder.
  • For archive features, upload or submit an archive whose entry names contain parent-directory segments or symlinks and check whether files are written outside the extraction directory. Test absolute entry names as well as relative traversal, since some tools reject only one. A symlink entry pointing outside the destination is worth trying separately.
  • Do not stop at reading a harmless file. Read configuration files and runtime logs and look for database credentials, signing keys, admin credentials or cloud access keys, then show what those credentials unlock. Reports show plain text credentials in logs leading to admin panel access, and pre-authentication reads leading to the credential database and login.
  • After confirming traversal, look for a chain to code execution: writing to web-accessible directories, overwriting configuration, or planting a file in a startup or autorun location. A write that lands in a scheduled task or cron drop-in is a much stronger finding than a read, and the evidence supports both.
  • Try the bypasses rather than giving up at the first rejection. Use backslashes on Windows-hosted targets, double encoding, nested sequences that survive a strip, an absolute path when traversal is blocked, or a path supplied as a buffer. Compare how the server normalises each form.

Start here: a reading path

Open the path

Clear reports in order, easiest first.

Guides and techniques

View all

The best explainers, cheat sheets and technique posts on Path traversal, from around the web.

Newest reports

All 1,809

Most recently disclosed.

New Path traversal reports by email

Follow Path traversal and get each week's new disclosures in one short email.

Free. New reports for what you follow, weekly by default. One-click unsubscribe. Privacy