
Web servers worldwide are experiencing a surge in automated attacks targeting hidden folders such as .env, .aws, and .git. These attacks aim to steal sensitive data including API keys, database passwords, and cloud credentials, often due to misconfigured servers or careless deployment.
π¨ What Attackers Are Trying to Access
Automated attack bots scrape servers for sensitive files like:
GET /.env
GET /.aws/credentials
GET /.git/config
GET /.vscode/settings.json
GET /.npmrc
GET /config/database.yml
- Database login information
- AWS access keys
- Git repository endpoints
- Package publishing tokens
One exposed file is enough to compromise an entire system.
π£ Real-World Security Impact
- .env leak β DB credentials stolen β full data dump
- .aws/credentials leak β unauthorized access to S3 / Lambda / CloudWatch
- .git exposure β source code, internal endpoints, and tokens leaked
- .npmrc leak β malicious package uploads under your identity
π How to Protect Your Server Immediately
1οΈβ£ Move hidden folders outside the web root
/var/www/html/.env
/var/www/html/.aws/
/var/www/html/.git/
2οΈβ£ Block dotfiles in Nginx / Apache
Nginx:
location ~ /\. {
deny all;
return 404;
}
Apache:
<FilesMatch "^\.">
Require all denied
</FilesMatch>
3οΈβ£ Never commit .env files
Use environment variables, Docker Secrets, or CI/CD Secrets.
4οΈβ£ Monitor logs for suspicious access attempts
/.env
/.git
/.aws/credentials
Block repeated offenders and consider adding automated alerts.
β οΈ Final Warning
If a sensitive file is accessible from the web, assume it is already leaked.
Attackers check hidden folders before anything else. Protect .env, .aws, .git, and all dotfiles immediately.