Directory Traversal and LFI worth $400
A file parameter on a media endpoint allowed directory traversal, letting the attacker list server directories and then read files from a database-dump directory containing usernames and password hashes. The attacker cracked the admin password hash and took over the web application.
Published on medium.com
Hi! I am Hritik and this write-up is mainly for the beginners in the field of bug bounty.
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 passed a user-supplied file path parameter directly to a file-reading function without validating or restricting the path.
Impact
An attacker could read sensitive files including database dumps with usernames and password hashes, and after cracking the admin hash, take over the web application.
What the attacker needed
Access to the web application; no authentication needed
How it was found
- Find the media endpoint with a file path parameter.
- Send traversal sequences in the parameter to list server directories.
- Try different endpoint extensions to find one that lists files.
- Traverse into a database-dump directory and read its contents.
- Crack the admin password hash and log in.
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.
Directory traversal is when a web address includes something like '../' to step out of the folder the site meant you to see and into other folders on the server. Here the site put a file path in the URL and did not check it, so the attacker could browse folders and read files, including a backup of the database with user passwords. The passwords were stored as hashes (scrambled one-way), but the admin's hash was weak enough to crack.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.