Git Directory Exposed Leads to Credentials Disclosure
An exposed .git directory on a production web server allowed the full source code to be downloaded, and the .git/config file revealed a GitLab URL. The attacker then found a publicly accessible GitLab project containing hardcoded RabbitMQ credentials, which were valid and granted access to the RabbitMQ management interface.
Published on medium.com
In this post, I will show you how I “accidentally” discovered a vulnerability in one of the Indonesian cloud provider companies that could lead to information disclosure such as hardcoded credentials. There’s no sophisticated tool used since I just used a Chrome browser & extension called DotGit (An extension for…
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 was deployed to the production server and not blocked, and credentials were committed to a Git repository that was publicly accessible.
Impact
The exposed source code and valid credentials could allow an attacker to access the RabbitMQ management interface and potentially steal data or damage systems.
What the attacker needed
None
The fix
The company restricted access to the .git directory by returning 403 Forbidden, and the report recommends excluding .git from deployments and revoking exposed credentials.
How it was found
- Visit the target website and notice that the .git directory is exposed.
- Confirm access by requesting the .git/config file.
- Use git-dumper to download the full source code from the exposed .git directory.
- Check the downloaded repository with git log and tree.
- Open the GitLab URL found in .git/config and browse public projects.
- Find a config file with hardcoded RabbitMQ credentials and use them to log in to the RabbitMQ management page.
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 part of a code repository and should never be on a public website. If it is, anyone can download the whole history of the site's code. Here, that code pointed to a code-sharing site where a file with a username and password for a message queue service was left visible, and those credentials still worked.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.