Exposure Protocol: Information Disclosure in the Wild [Part 4]
An exposed .git directory on a production server allowed the full repository history to be downloaded, revealing a previously hardcoded admin password in a commit diff. An attacker could use that password to log in as administrator and delete a user.
infosecwriteups.com
Published on infosecwriteups.com
Welcome back to Exposure Protocol, where we rip the masks off info leaks — one layer at a time.
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
The .git directory was left publicly accessible on the production server, exposing the full commit history including a previously hardcoded admin password.
Impact
An attacker could gain unauthorized admin access and delete user accounts.
What the attacker needed
Exposed .git directory; no authentication needed to download .git
The fix
The .git directory should not be deployed to production, and secrets should be scrubbed from history using tools like git filter-branch or BFG Repo-Cleaner.
How it was found
- Visit the lab and try to access the /.git directory, which is exposed and browsable.
- Recursively download the entire .git repository from the live server using wget.
- Open the downloaded repository in git-cola.
- View the history of admin.conf and find a commit that removed the admin password from the config.
- Use the password from the Git diff to log in as administrator.
- Navigate to the admin panel and delete the user Carlos.
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 directory is a hidden folder that stores a project's version history. If a website leaves it accessible, anyone can download the whole history and see old versions of files, including secrets that were later removed. Here, an old commit still contained the admin password, so the attacker could log in as admin.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.