Git-Dumped, DB-Hijacked, Shell-Dropped: The Accidental WordPress
A publicly accessible .git directory exposed the site's source, including wp-config.php with database credentials. Those credentials worked on a live database management interface, letting the author create an admin WordPress user and upload a web shell.
I came across a random site linked in a Facebook post — probably shared by someone who had no idea what kind of treasure they were dropping. Out of curiosity, I opened the site in my browser.
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 .git directory and a database management script were left publicly accessible, and the database credentials were reused for that interface.
Impact
An attacker could gain full administrative control of the WordPress site and execute code on the server.
What the attacker needed
Publicly accessible .git directory; database tool left on production; credentials reused from wp-config.php
The fix
The .git directory and the database interface should be removed from production, and database credentials should not be reused for other services.
How it was found
- Found a site with a publicly accessible .git directory.
- Dumped the repository with git-dumper.
- Spotted a database management file still live on production.
- Read database credentials from wp-config.php in the dump.
- Logged into the database interface with those credentials.
- Created an admin WordPress user, disabled the WAF, installed a file manager plugin and uploaded a web shell.
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 .git folder is the hidden history of a website's code, and if it is left on the public server anyone can download it. Here it contained a settings file with the database username and password, and those same details unlocked a database tool that was also left online. From there the author could add an admin account and upload a file that runs commands on the server.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.