Skip to content
Info disclosure Write-up Beginner

️ Push to Prod, Oops: How an Exposed Git Folder Gave Me Credent

An exposed .git directory on a production asset server allowed the attacker to download the entire source code, which contained hardcoded database, JWT, AWS, and SMTP credentials. Using these credentials and a leaked .DS_Store file, the attacker accessed a deprecated admin login page and logged in.

iski Follow

Published on medium.com

Free Link 🎈

Iski, on medium.com

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 production build process included the .git directory and sensitive configuration files (.env, credentials.yaml) in the deployed web root, and a .DS_Store file was also left publicly accessible.

Impact

The attacker could obtain full source code and hardcoded credentials for database, JWT, AWS, and SMTP, and could log in to a deprecated admin panel, potentially leading to further compromise.

What the attacker needed

Publicly accessible .git directory; publicly accessible .DS_Store file; secrets stored in repository files

How it was found

  1. Run directory brute-forcing with extensions including git, bak, env, zip, tar, old on the target host.
  2. Discover that /.git/HEAD returns HTTP 200.
  3. Use git-dumper to download the entire .git repository to a local directory.
  4. Inspect the dumped repository and find .env, config/prod_settings.json, and credentials.yaml containing secrets.
  5. Access the exposed .DS_Store file and use ds_store_exp.py to list internal directories and files.
  6. Use the leaked credentials to log in to the deprecated /old_admin/ login 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 version control system that stores all the code and its history. If it is left on a public web server, anyone can download the source code. Here, that code also contained passwords and keys, which let the attacker break into other systems.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by iski

View all

186 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.