Skip to content
Path traversal Write-up Beginner

File Not Found? Maybe You Just Aren’t Looking Hard Enough

The write-up walks through five PortSwigger path traversal labs where a product image parameter is used to read arbitrary files. In each lab the attacker retrieves the contents of the system password file by bypassing a different filter on the filename.

callgh0st Follow

Published on infosecwriteups.com

Path traversal is also known as directory traversal. These vulnerabilities enable an attacker to read arbitrary files on the server that is running an application.

callgh0st, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application passes a user-supplied filename to a file read without properly normalising it, and its filters are incomplete or applied in the wrong order.

Impact

An attacker could read arbitrary files on the server, which may include application code, credentials and sensitive operating system files.

What the attacker needed

Access to the image request; an intercepting proxy

The fix

The application should resolve the requested filename against the intended base directory and reject any result that falls outside it, rather than relying on string stripping or decoding.

How it was found

  1. Open a product image and note the image identifier in the request.
  2. Send the image request to an intercepting proxy and change the filename to a traversal sequence.
  3. For the blocked-sequence lab, use an absolute path instead of traversal.
  4. For the stripping lab, use nested sequences that survive the strip.
  5. For the decoding lab, double-encode the traversal sequence.
  6. For the start-of-path lab, begin with the expected folder then traverse upwards.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A web page sometimes asks the server for a file by name, such as an image. If the server trusts that name without cleaning it, someone can ask for a file outside the intended folder, like a system file holding user accounts. This is called path traversal, and the write-up shows several ways filters meant to stop it can be dodged.

What is Path traversal?

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

More by callgh0st

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

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