Git repo on https://██████.mil/ discloses API password
A publicly accessible .git repository on a .mil domain exposed the full source code of the server, including an API password for Yubikey hardware authentication software. An attacker could read the source code and obtain the password, though the API was not functional at the time of testing.
- Triaged in 21 hours
- Fixed in 15 months
- Disclosed after 15 months
Summary: I found a .git repository on https://███████.mil/.git which discloses an API password for Yubikey on 2 different domains, together with full source code.
Description: Fetching the git repository and decompressing the objects results in the ability to read the source code of the server, which includes an API password for the Yubikey hardware authentication software. The API however does not appear to be functional on the main domain, but since the repository is very recent, I cannot be certain that it'll stay non-functional. Additionally, the server discloses info.php at https://███████.mil/info.php. I'm uncertain if this should be reported separately, any comments on this would be very welcome!
Impact
I'm rating the impact of this primarily as an information disclosure. The repository appears to have been active within the past months, so any future additions will be disclosed too. I was unable to use the found password as the API appears to be currently non-functional, but since the repo is active I would expect the server to be worked upon, and the API to be functional in the future. For this reason I've decided to make you aware of the issue. Also, even if the password were to be changed, it would of course still be disclosed on the repository. Furthermore, the repository discloses the full source code of the served pages.
Step-by-step Reproduction Instructions
- Fetch the repo with wget:
wget --no-parent -r https://█████.mil/.git/ --no-check-certificate
2. Write the following python script (remember to update the 'pwd' variable):
import zlib import os pwd = INSERT FULL PATH WHERE THE REPO WAS DOWNLOADED + '█████████.mil/.git/objects/' for subdir, dirs, files in os.walk(pwd): for file in files: if not file.startswith("index"): filename = subdir + '/' + file compressed_contents = open(filename, 'rb').read() decompressed_contents = zlib.decompress(compressed_contents) print(str(decompressed_contents) + '\n')
The script is also attached as a file. 3. Run the script with
python gitreader.py | grep -i -E -o ".{0,138}restPW.{0,22}"
Which greps the output for the string where the password is, together with the paths/domains. Of course, the full contents of the repository are available to look through.
Example output:
'https://███
Product, Version, and Configuration (If applicable)
Suggested Mitigation/Remediation Actions
Remove the .git repository from the server, since it contains sensitive information.
Impact
I'm rating the impact of this primarily as an information disclosure. The repository appears to have been active within the past months, so any future additions will be disclosed too. I was unable to use the found password as the API appears to be currently non-functional, but since the repo is active I would expect the server to be worked upon, and the API to be functional in the future. For this reason I've decided to make you aware of the issue. Also, even if the password were to be changed, it would of course still be disclosed on the repository. Furthermore, the repository discloses the full source code of the served pages.
Not written yet. The AI write-up for this report 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 web server and left publicly accessible, exposing the full repository contents including secrets.
Impact
The exposed repository disclosed the full source code and an API password, but the API was not functional at the time, so the password could not be used; the report notes the repository is active and the API might become functional in the future.
What the attacker needed
None
The fix
The .git repository should be removed from the server because it contains sensitive information.
How it was found
- Fetch the .git repository from the target domain using wget.
- Write a Python script to walk the downloaded objects and decompress them with zlib.
- Run the script and grep the output for the password string and associated paths/domains.
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 report has not been written yet. The Original tab links to the source.
A .git folder is part of a version control system that developers use to track changes to code. If it is left on a public web server, anyone can download it and reconstruct the source code, including secrets like passwords. Here, the exposed repository contained a password for an authentication service, which could let someone access that service if it were active.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.