Skip to content
Path traversal Write-up Beginner

That One “Download” Endpoint That Shouldn’t Have Been There

A download endpoint accepted a filename parameter and used it to build a file path without proper normalisation, so a crafted path with broken traversal sequences could read files outside the intended directory. The author confirmed this by reading a system password file and then an application environment file containing database credentials.

medium.com

Published on medium.com

Target was already crowded, most obvious stuff patched. I was just going through endpoints slowly, trying not to overthink it.

T4nv1, on medium.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 filtered for the literal string '../' but did not normalise the path before using it, so alternative traversal sequences were resolved by the filesystem.

Impact

An attacker could read arbitrary files on the server, including configuration files with database credentials, which could lead to database access and possibly cloud credentials.

What the attacker needed

Access to the download endpoint; no authentication required

The fix

The application should normalise the requested path and restrict file access to a fixed directory rather than filtering for specific strings.

How it was found

  1. Request a normal file through the download endpoint to confirm it works.
  2. Try a standard traversal sequence and observe it is blocked or returns an error.
  3. Try a broken traversal pattern such as repeated dots and slashes and observe a different response.
  4. Use the broken pattern to read a system password file and confirm file read.
  5. Use the same technique to read an application environment file containing credentials.

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 app lets you ask for a file by name, like a download link. The server takes that name and looks for the file on its disk. If it does not clean up the name properly, you can use special characters to climb out of the intended folder and read other files on the server, such as configuration files with passwords.

What is Path traversal?

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

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.