Skip to content
StrikeOps

Exposed .git Directory on a Web Server

HighTypical severity Containers, CI/CD and source codeCWE-538

01Description

The web server served the contents of the .git directory, allowing the repository to be downloaded.

02Impact

An attacker can reconstruct the application's full source code and commit history, revealing vulnerabilities, internal endpoints and any secrets ever committed.

03Severity

Typically

High

Typically High. High, as the full source code and history can usually be downloaded. Critical if the history contains active secrets.

04How to verify

  1. 1Request /.git/HEAD and /.git/config on each web host.
  2. 2Where authorized, confirm that objects can be retrieved, without downloading more than needed.

Testing note: only test systems you are authorized to test, within the agreed scope and rules of engagement. Verification steps are written for professional testers and avoid destructive techniques.

05Remediation

  1. 1Block access to hidden directories in the web server configuration.
  2. 2Deploy build artifacts rather than repository checkouts.
  3. 3Rotate any secrets found in the repository history.

06References

Draft findings like this from your own evidence

Book a demo
Book a demo