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.
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
- Request a normal file through the download endpoint to confirm it works.
- Try a standard traversal sequence and observe it is blocked or returns an error.
- Try a broken traversal pattern such as repeated dots and slashes and observe a different response.
- Use the broken pattern to read a system password file and confirm file read.
- 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.