Chaining the Boredom: How a Quiet Weekday Led to a Full Database Heist
The application's layout parameter was vulnerable to local file inclusion, allowing an attacker to read arbitrary files. By reading the source code, the attacker found a hardcoded admin API key and a hidden database export endpoint, then used the key to download the entire user database.
infosecwriteups.com
Published on infosecwriteups.com
Valentines might not be in the cards for me in real life, but who needs a date when you have a terminal? While the rest of the world is busy with roses and dinner reservations, I’m busy finding vulnerabilities and committing to the “one” thing that never lets me down: a successful exploit chain.
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 user-controlled input directly to a file-opening function without validation, and also stored a secret key in source code.
Impact
An attacker could read arbitrary files on the server and, by chaining with source disclosure and a hardcoded secret, exfiltrate the entire user database.
What the attacker needed
Access to the web application; ability to intercept HTTP requests
The fix
The application should use an allowlist of valid layout file names and store secrets in environment variables instead of hardcoding them.
How it was found
- Intercept a request containing the layout parameter.
- Modify the layout parameter to attempt directory traversal.
- Observe that the server returns the contents of /etc/passwd, confirming local file inclusion.
- Use the same technique to read the application source file app.py.
- Extract the hardcoded admin API key and the hidden database export route from the source.
- Send a request to the export endpoint with the stolen key in the X-Valentine-Token header to download the database.
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 took a file name from the URL and opened it without checking. An attacker could ask for other files on the server, like the password file or the program's own code. The code contained a secret key that let the attacker download all user data.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.