Information Disclosure part-5 : Information disclosure in versio
The web server exposed its .git directory, allowing an attacker to download the repository and inspect commit history. A password that had been removed from the current files was still present in an earlier commit, enabling login as administrator.
Published on medium.com
In the process of testing application security, I often find that seemingly trivial aspects hold serious potential risks — one of which is version control history.
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 publicly accessible on the web server, exposing the full commit history including a previously committed admin password.
Impact
An attacker could recover the administrator password from the commit history and log in as admin, then delete other users.
What the attacker needed
The .git directory is publicly accessible; No authentication needed to download it
The fix
The .git directory should not be deployed to the web server, and access to it should be blocked; any leaked secrets should be rotated.
How it was found
- Perform directory enumeration with Dirsearch and find the .git directory is publicly accessible.
- Dump the repository using git-dumper.
- Check the current files and find the admin password has been removed.
- Run git log to see the commit history.
- Run git log -p to view changes and find the deleted admin password.
- Log in with the recovered credentials 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 version control system like Git keeps a record of every change made to a project's files. If the hidden .git folder is left on a public web server, anyone can download that record. Even if a password was deleted from the current files, it can still be found in the old history.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.