Website security · Raksha guide
Exposed .env, .git and Backup Files: How to Check Your Site
Configuration files, Git metadata and backups should not be downloadable from a public web root. A request in your logs is not proof of a leak, and HTTP 200 is not proof that a file exists: many applications return their homepage for unknown paths.
By Raksha · Reviewed 16 November 2026
Files worth reviewing
| Path or artifact | Potential exposure | Evidence needed |
|---|---|---|
| .env / .env.production | Credentials and internal configuration. | Configuration content, not an HTML application shell; redact values. |
| .git/HEAD / .git/config | Repository metadata and possible code-history exposure. | Recognisable Git content; do not download the full repository to prove access. |
| backup.zip / database dumps | Source, personal data or database contents. | A real accessible backup artifact, not a filename guessed from a status code. |
| Configuration backup files | Old credentials and deployment settings. | A supported content signature and affected resource. |
Do not assign Critical to every path automatically. Severity depends on content, access, whether credentials work and the affected resources. Public robots.txt, sitemap.xml and security.txt are normally intentional, not leaks by themselves.
Check safely with curl
Only use your own target or one you have explicit permission to assess. Start with response headers; do not fetch large backups or actual customer data just to establish exposure.
curl -sS -I https://example.com/.env
curl -sS -I https://example.com/.git/HEAD
curl -sS -I https://example.com/.git/config
curl -sS -I https://example.com/raksha-unlikely-path-7f2c9aA 403 or 404 suggests that request was blocked or unavailable, not that every deployment is safe. HEAD and GET can differ. If a bounded content check is necessary, do it in an authorised environment and keep secrets out of terminal captures and tickets.
Why a SPA can return a false 200
Compare the suspected path against an unlikely missing path and the homepage. Similar HTML, titles and application shell content suggest a catch-all route. Dynamic timestamps can change a body hash, so exact equality alone is not enough.
Confirm the expected file format and a meaningful security consequence before reporting a vulnerability. An HTML login screen or generic error inside a 200 response is not a downloadable .env file. Treat ambiguous responses as inconclusive, not confirmed.
Contain the exposure and rotate secrets
- Restrict access immediately and preserve a minimal, redacted record of the exposure.
- Revoke or rotate affected credentials promptly; blocking the path does not invalidate a copied key.
- Review provider and application logs for misuse and determine the affected scope.
- Remove sensitive artifacts from the web root, images and deployment output.
- Invalidate relevant CDN caches and verify every affected hostname.
- Repeat the supported check and track incident obligations separately.
Do containment and credential rotation in parallel where possible. Never paste leaked values into a report, chat or public issue.
Prevent repeat exposure
Deploy only intentional public artifacts. Exclude version-control folders, environment files and backups at build time and enforce access rules at the actual serving layer. Disabling directory listings does not block requests for known individual filenames.
Do requests for /.env mean I was hacked?
No. They show someone asked for a path. Investigate what was returned, then correlate with access and credential logs.
What to check if compromise is suspectedSources and further reading
Consult current official documentation before changing a production system. Examples are illustrative, not live findings or universal configurations.
Start with a site you are authorised to test
A free passive check needs no card. Sign-in, email confirmation, ownership rules and usage limits apply. It is not an unrestricted penetration test.