Local File Inclusion lead to Admin Account Takeover
A local file inclusion flaw in an API endpoint allowed reading arbitrary files on the server. The attacker used it to read a Git index file and a seed file, obtaining admin credentials.
medium.com
Published on medium.com
Hello everyone, I recently discovered an interesting vulnerability. The discovery process involved collecting small clues and piecing them together until a security flaw became clear.
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 API endpoint accepted a file path from the user and returned the file's contents without restricting which files could be read.
Impact
An attacker could read sensitive files and obtain admin credentials, leading to admin account takeover.
What the attacker needed
Access to the API endpoint; no authentication mentioned
How it was found
- Fuzz an API URL with FFUF and note that a 200 response means a valid file and a 301 means a valid folder.
- Put a valid file path into Burp Repeater and see the file contents returned.
- Try reading a common Linux system file and confirm its contents are shown.
- Keep fuzzing folders to find other sensitive files.
- Find a .git/index file and use it to discover the name of a randomly named seed file.
- Read the seed file to obtain valid admin 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.
Local file inclusion (LFI) is when a web app lets you ask for a file on its own server by changing a path in the request. Here the attacker could read system files and then find a file that contained an admin username and password.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.