The File Upload Check That 90% of Hunters Forget (And How I Got $1500 From a JPEG)
A thumbnail endpoint joined a user-supplied path parameter onto a storage path without sanitisation, allowing path traversal. Because every user's hashed filename was exposed in public profile pages, an attacker could read other users' private photos.
Published on medium.com
Rename a PHP file to .jpg. Try to upload an .svg with script tags.
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 thumbnail endpoint concatenated an unsanitised path parameter onto a storage prefix, and the hashed filenames needed to target other users were publicly listed.
Impact
An attacker could read other users' private uploaded photos by combining a traversal in the thumbnail path with publicly exposed hashed filenames.
What the attacker needed
A free account; victim has uploaded a photo; victim's hashed filename is public
The fix
The thumbnail endpoint should resolve the requested path against the storage root, reject traversal sequences, and serve files only after an ownership check.
How it was found
- Upload a normal profile picture and observe the thumbnail URL containing a path parameter and a size parameter.
- Change the size parameter to a traversal sequence and note the error disclosing a full file system path.
- Change the path parameter to a traversal sequence pointing at the uploaded file and confirm the thumbnail loads.
- Collect another user's hashed filename from the public profile page source.
- Request the thumbnail endpoint with a traversal path to that user's file and retrieve their private photo.
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.
When you upload a picture, the site often makes a smaller copy called a thumbnail. The address used to request that thumbnail included a file path the user could edit. The site pasted that path straight into a server file location without checking it, so by using '..' sequences a user could step out of the intended folder and read other people's files.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.