Skip to content
Info disclosure Write-up Beginner

4,500 of the Top 1 Million Websites Leaked Source Code, Secrets

Thousands of popular websites publicly exposed their .git directories, allowing anyone to download the full source code and any secrets stored in it. Attackers could use the leaked code and live credentials to compromise the sites or their third-party services.

trufflesec Follow

Published on trufflesecurity.com

Our research team discovered 4,500 of the most visited websites in the world publicly exposed their git directory (ie https://example.com/.git).

Truffle Security (@trufflesec), Harsh Bothra (@harshbothra_), Luke Stephens (@hakluke), on trufflesecurity.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 .git directory was deployed to production web servers without access controls, so it was publicly reachable.

Impact

Attackers could read private source code and use live credentials, including admin-level GitHub tokens and a TLS private key that could enable man-in-the-middle attacks; some sites blocked direct access to the .git path but still exposed its files.

What the attacker needed

Internet access; target exposes .git directory

The fix

The .git directory should be removed from production servers and access to it restricted at the web server, and any exposed secrets should be rotated.

How it was found

  1. Request the site's .git/config file and check the first line to confirm a valid Git config.
  2. Use Goop to reconstruct and download the exposed Git repository.
  3. Run TruffleHog against the local repository to find secrets.
  4. Re-run with the only-verified flag to see which secrets are live.

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 a hidden folder that a website's developers use to track changes to their code. If that folder is left on the public web server, anyone can download it and see the private code and any passwords or keys saved inside. This report found thousands of sites making that mistake.

What is Info disclosure?

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

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.