Loading...
Loading...
A publicly reachable `/.git/` directory exposes your entire source code, commit history, configuration, and anything committed by mistake.
Anyone can clone the whole repository with `git-dumper` or `wget --mirror`. That means every line of your backend source, internal API routes not linked from the frontend, hardcoded credentials from early commits (AWS keys, database passwords, JWT secrets that may still be valid), and any commit message that mentions an unpatched vulnerability. Exposed `.git` is a recurring top-10 finding in breach post-mortems because the source gives attackers a roadmap for everything else.
Remediation order matters. Block the directory at the web server first, then rotate every credential that appears anywhere in the history, then decide whether the exposure window requires customer notification. Deleting the `.git` folder from the server does not help anyone who cloned it while it was exposed. Assume the worst and rotate.
Probe the two canonical files. A `200 OK` with content on `/.git/HEAD` or `/.git/config` is an immediate critical finding. A `403 Forbidden` still confirms the directory exists and may be partially reachable. Only `404` or a generic error page is safe.
curl -sI https://yourdomain.com/.git/HEADcurl -s https://yourdomain.com/.git/configpip install git-dumper && git-dumper https://yourdomain.com/.git ./cloned # test on your own site onlyYou usually cannot be certain. Check web server access logs for requests matching `/.git/*` from unfamiliar user agents. Assume cloning happened and rotate every secret that appears anywhere in the commit history.
They grep for credentials in commit history (AWS keys, database URLs, API tokens), read internal API route definitions, look for unpatched vulnerability references in commit messages, and use the blame/log to identify active developers for spear-phishing.
Only if Cloudflare is proxying (orange cloud) and you have a WAF rule blocking `/.git/*`. If your origin IP is discoverable, attackers can bypass Cloudflare entirely. Add origin-side blocking too.
Applied the configuration change? Run a live scan to confirm the vulnerability is patched.