On this page
- How did the 2026 campaigns get hold of .env files?
- Why is a 404 on /.env not the whole answer?
- What does the scanning traffic in my logs actually mean?
- Which setups put a .env file where the web server can reach it?
- How do I check, in the order that matters?
- What do I rotate first if a file answered?
- How do I stop the file being served?
- Am I affected? A three-state self-test
- Where does the free scan fit?
To check whether your .env file is publicly readable, request /.env, a few variants like /.env.production, and /.git/HEAD on your own domain and read the status and size. A 404 or 403 means that URL refused. A 200 with short, file-like content means rotate every secret inside before anything else. A refusal does not cover a server that was compromised another way.
| Fact | Detail | Source (checked 24 October 2026) |
|---|---|---|
| Route 1: public path read | Scanners ask for /.env on every site and keep what answers. Unit 42 described a campaign covering 110,000 domains | Unit 42, 15 Aug 2024 |
| Route 2: read after compromise | An operator server held 65,000+ archived .env entries collected from hosts compromised through CVE-2025-55182 | The DFIR Report, 22 Apr 2026 |
| Background noise in 2026 | 824 IP addresses requested /.env and similar paths between 28 July and 23 August 2026. GreyNoise saw requests, not returned files | GreyNoise |
| First action if exposed | Revoke the secret with its provider. Removing it from the code does not stop its use | GitHub Docs |
The 30-second command and how to read a log line are in the bots requesting /.env and /.git check. This page covers what the 2026 reports add: why a closed URL is half the answer, and what to rotate in what order.
How did the 2026 campaigns get hold of .env files?
Two different ways, and reports often blur them. The first is the plain one. A scanner requests /.env over the web, and a server that returns the file hands over its contents. Unit 42 described this in August 2024: it reported more than 230 million unique targets scanned, 110,000 domains targeted, and over 90,000 unique combinations of leaked environment variables, including about 7,000 access keys tied to cloud services.
The second way needs a flaw in the software. The DFIR Report analysed an operator server that was left open to the internet. It reported more than 900 confirmed compromises through React2Shell (CVE-2025-55182) and tooling that collected .env files from those hosts. Between 10 and 21 April 2026 the server held 400+ batches and over 30,000 distinct .env filenames, about 65,000 archived entries.
Why is a 404 on /.env not the whole answer?
A 404 describes one URL on one host at one moment. It says nothing about route 2, where an attacker never asks your web server for the file. The DFIR Report's tooling ran on hosts that were already compromised, so a deny rule on /.env would not have changed what it could read.
This matters most for apps with a known remote code execution flaw. GitHub's advisory for CVE-2025-55182 gives it CVSS 10.0 and lists patched versions 19.0.1, 19.1.2 and 19.2.1 of the React Server Components packages, published 3 December 2025. If your app runs React 19 server code, check your build against the React2Shell page. If it was unpatched at any point in 2026, treat its environment secrets as possibly read, whatever your URLs return today.
What does the scanning traffic in my logs actually mean?
Most of it is route 1 probing, and it is constant. GreyNoise's August 2026 report found 824 IP addresses across 795 networks asking for /.env, /app/.env, /.aws/credentials, /.env.production and /.git/config, many under forged names of AI crawlers. GreyNoise states that nothing it saw says a file was returned or that any organization was affected.
The paths vary by folder. A SANS Internet Storm Center honeypot table from May 2023 counted 22,004 requests for /.env, then /laravel/.env, /web/.env, /admin/.env, /api/.env and /backend/.env. In July 2026 another SANS diary recorded requests for AI assistant config files such as /.claude/mcp.json and /.cursor/mcp.json, about 200 over 14 days on its sensors. Add your own tool's config folders to the check.
Which setups put a .env file where the web server can reach it?
| Setup | How it ends up readable | What the docs say |
|---|---|---|
| Laravel with the wrong document root | The web server points at the project folder instead of public/ | Laravel: .env should not be committed, and APP_DEBUG should be false in production |
| FTP upload of the whole project | Dotfiles travel with the folder into the web root | Ship built output only |
| Container built from the full folder | COPY . . includes the .env file in the image | Docker: .dockerignore excludes files; do not use --build-arg for secrets |
| Git clone into the web root | The .git folder is served, and its history can hold old secrets | GreyNoise: exposed .git/config can reveal remotes and, in full, the code and history |
| Public prefix on a secret | The build tool copies the value into files every visitor downloads | Next.js inlines NEXT_PUBLIC_ values; Vite says VITE_ values should not hold API keys |
The last row is not a readable file. The result is the same, so rotate those keys too. A dev server started with --host can also serve a .env, and a file committed to a repository needs its own order: rotate first, clean history second.
How do I check, in the order that matters?
Run the web check, then answer the questions a web check cannot.
- Request
/.env,/.env.production,/.env.local,/.env.bakand/.git/HEADon the bare name, www and every staging subdomain, printing only status and size - Add the folder names your deploy uses, such as
/app/,/api/and/backend/ - Search your access log for earlier 200 responses on those paths, to learn how long a file was reachable
- List every framework and server component the app runs, and note any that had a critical fix this year
- Confirm the running build contains each fix, not only the package on disk
- Open your built JavaScript and search for key-shaped strings, because prefixed variables ship to every visitor
A 403 still says the file exists, as MDN notes, so a 403 on /.env is a reminder to check what the file holds. A server may also return 404 to hide a file it refuses to serve.
What do I rotate first if a file answered?
Start where a stolen value does the most damage. GitHub says to treat any leaked secret as compromised and calls revoking it with the provider the most important step. OWASP says exposed keys should be revoked immediately.
| Secret type | Where you rotate it | Then check |
|---|---|---|
| Cloud access keys | The cloud provider's key management | The provider's audit log for use of the old key. Unit 42 recommends temporary credentials, least privilege and logging |
| Payment and mail keys | The provider's dashboard | Recent activity and sent volume |
| AI provider keys | The provider's console | Usage and spend since the file was reachable |
| Database passwords | The database, then the app config | Connections from addresses you do not recognise |
| App and signing keys | Your app. For Laravel see rotating APP_KEY safely | Sessions and signed links made with the old key |
The DFIR Report listed AI platforms, cloud providers, messaging, payments, databases and cryptocurrency custody among the harvested categories, and said the operator concentrated follow-up on organizations that met a value threshold, particularly in financial, cryptocurrency and retail. Order your rotation the same way an attacker would triage: money first, then access, then convenience. The step-by-step rotation routine covers the wider routine, the Railway breach steps show it for a platform that told every user to rotate, and the other secrets and supply chain guides go further.
How do I stop the file being served?
Keep it out of the document root. Ship built output or the public folder only, and move secrets to the host's environment settings or a secrets manager, which OWASP prefers over plain environment variables. A deny rule is the second layer. In nginx a regular expression location like location ~ /\.(?!well-known) { return 404; } can do it, but nginx checks regular expressions after the longest prefix, and a prefix marked ^~ stops that search. Test the rule, reload, and repeat the check. The same mistake on a static host looks a little different, as in an env file published on Cloudflare Pages.
If a host runs the server, send this:
Please confirm whether the document root of [domain] contains files named .env, .env.* or a .git folder. If it does, move them out of the document root. Please also tell me which rules deny dotfiles on this plan, from what date, and whether the PHP, Node or framework components on this site have every vendor fix from this year.
Am I affected? A three-state self-test
Am I affected? Where you stand right now
A request from outside shows what a URL returns today. It cannot see a different folder, a subdomain you did not try, or what a compromised server holds inside.
- Detected One of your own URLs returned a 200 with file-like content. Rotate every secret in that file first, then move the file out of the web root and block the path.
- Unknown Every URL you tried was refused, but you have not confirmed the other folders, subdomains or the patch state of your framework. This is the common case. Finish the checklist above and ask the host the question in the blockquote.
- Confirmed by owner evidence You hold the web root file listing from the server or build output with no .env or .git entries, plus a build identifier showing the framework fix. Those routes are closed. Whether anyone read a file before then is a question for the access log.
No scan, ours included, moves you from "unknown" to "confirmed".
Where does the free scan fit?
Red's free scan looks for .git, .env, backups and open directory listings, and for API keys and tokens in shipped bundles, on a domain you prove you own. It reads what your site serves, so it can say that a file answers. It is a lookup: it cannot tell you who fetched a file last month or what a compromised server holds.
Questions people ask
How can I check if my .env file is publicly accessible?
Request /.env, /.env.production and /.git/HEAD on your own domain, including www and any staging subdomain, and print only the status code and size. A 404 or 403 with a small response is the expected result. A 200 with a short, file-sized response means you read it on your own machine and rotate what it holds.
My /.env returns 404. Does that mean my secrets are not exposed?
It means that URL on that host refused the request when you tried it. The 2026 reports describe two routes to a .env file, and a 404 only covers the first. A server that is compromised through a software flaw can have its .env read from inside, and no URL rule changes that.
If my .env was exposed, is deleting the file enough?
No. Anyone who fetched the file already has the values, and deleting it does not take them back. Revoke or rotate each credential with the provider that issued it first, then remove the file from the web root and block the path.
Do I need to rotate keys if bots only requested /.env and got a 404?
Not for that reason alone. A refused request exposes nothing. Rotate if any request for the file ever returned a 200 with content, if the server ran a vulnerable component before it was patched, or if the file was committed to a repository.
Is a NEXT_PUBLIC_ or VITE_ key in my JavaScript the same problem?
It has a different cause with the same result. Those prefixes tell the build tool to copy the value into files every visitor downloads. Treat any real secret given such a prefix as public and rotate it.
Does a free scan prove my .env is not exposed?
No. A scan can show that a file answers at the time it ran. It cannot see a different folder it did not try, a subdomain you did not add, or what a compromised server holds internally. Your host or build output can confirm what sits in the web root.
Sources
- The DFIR Report: Bissa scanner exposed, AI-assisted exploitation and credential harvesting (22 April 2026)An exposed operator server: 900+ confirmed compromises through CVE-2025-55182, 65,000+ archived .env entries from 10 to 21 April 2026, secret categories and defender advice. Checked 24 October 2026.
- Unit 42: Large-scale cloud extortion operation using exposed .env files (15 August 2024)230 million targets scanned, 110,000 domains, 90,000+ unique variable combinations, what the attackers did with cloud keys. Checked 24 October 2026.
- GreyNoise: Threat actors are posing as AI crawlers to hunt for exposed credentials (2026)824 IP addresses, 28 July to 23 August 2026, most requested paths, and GreyNoise's own limit: it saw requests, not returned files. Checked 24 October 2026.
- GreyNoise: Spike in Git configuration crawling (April 2025)Nearly 4,800 unique IPs a day on 20 and 21 April 2025, what an exposed .git/config reveals, defender advice. Checked 24 October 2026.
- SANS Internet Storm Center: Increased Number of Configuration File Scans (3 May 2023)A honeypot's top .env paths with counts: /.env 22,004, then folder-prefixed variants. Checked 24 October 2026.
- SANS Internet Storm Center: Someone Is Scanning for Your MCP Servers and AI Assistant Credentials (13 July 2026)Requests for AI assistant config files such as /.claude/mcp.json and /.cursor/mcp.json, about 200 in 14 days on the author's sensors. Checked 24 October 2026.
- GitHub advisory GHSA-fv66-9v8q-g76r: React Server Components RCE (CVE-2025-55182)CVSS 10.0, patched in 19.0.1, 19.1.2 and 19.2.1, published 3 December 2025. Checked 24 October 2026.
- GitHub Docs: Remediating a leaked secretTreat a leaked secret as compromised; revoking it with the provider is the most important step. Checked 24 October 2026.
- OWASP Secrets Management Cheat SheetRevoke exposed keys immediately, rotate regularly, and prefer a secrets manager over environment variables. Checked 24 October 2026.
- Laravel 12.x documentation: Configuration.env should not be committed; APP_DEBUG must be false in production. Checked 24 October 2026.
- Next.js documentation: Environment VariablesNEXT_PUBLIC_ variables are inlined into JavaScript sent to the browser at build time. Checked 24 October 2026.
- Vite documentation: Env Variables and ModesVITE_ variables are bundled into source code and should not contain API keys. Checked 24 October 2026.
- Docker Docs: Build context.dockerignore excludes files from the build context; do not use --build-arg for secrets. Checked 24 October 2026.
- MDN: 403 ForbiddenServers may send 404 instead of 403 to avoid acknowledging a resource exists. Checked 24 October 2026.
- nginx documentation: location directivePrefix locations first, then regular expressions in order; ^~ stops the regular expression search. Checked 24 October 2026.
Facts on this page are dated and point at the primary source next to them. If a vendor status changes after the date shown, the vendor's page wins; tell us at support@run.cloud and we will update it.