Report an Incident Become a Partner Careers Contact
Book a Demo
Managed SOC

The Exploit Didn't Want A Shell. It Wanted Your .env File.

Adam Jones · CTO & Co-Founder 30 November 2026 6 min read
A request "GET /static/../.env" returning 200, above an .env file listing DB_PASSWORD, AZURE_CLIENT_SECRET, STORAGE_KEY, API_TOKEN and SMTP_PASS with the values redacted in red, beside the headline "It wanted your .env file".

For years, the mental model for an exploited web application went like this: the attacker finds a flaw, gets code running, drops a web shell, and the incident starts there. Patch prioritisation followed that model. Remote code execution went to the top of the list, and a bug that "only" let someone read a file went further down.

That model is out of date. On 23 November 2026, a vulnerability intelligence team published data from its network of exploitation sensors showing what attackers now do with exploits. More and more, they don't want a shell. They want the file where your application keeps its keys.

What the numbers say

  • Credential harvesting is now a large share of exploitation. Across January to November it made up 13% of all the exploitation records its sensors saw. Month by month it rose from about 1% in January to between 25% and 35% in September and October.
  • It is spread widely. 127 of the 694 exploited vulnerabilities tracked, about one in five, were used at least once to go after credentials.
  • It is growing fast. Monthly harvesting records rose from about 17,000 in July to 99,000 in October.
  • Medium-severity bugs punch above their weight. They were 6% of the vulnerabilities involved but 23% of the harvesting traffic. Examples include a Laravel log-disclosure flaw and a Mailpit SSRF, both rated 5.3.
  • The targets are the obvious ones: .env files, process environment variables, framework logs, cloud credential files, Git configuration, package-registry tokens, SSH keys and the cloud metadata service. Since May, attackers have also been probing for AI provider keys and the credential files of AI coding tools.

The common thread is that none of this needs code execution. A path traversal, an arbitrary file read, an SSRF or an authentication bypass on a static-file route is enough to return the contents of a .env file. That file often holds the database password, the cloud access key and the API key for every service the app talks to.

Our view: a file-read bug is a credential leak

We think organisations should stop treating "information disclosure" as a lesser category on internet-facing applications. In practice, if the application can read a secret, a file-read bug can return it. Three things follow.

1. Triage by what the app can read, not by the bug class

A CVSS score describes the flaw, not your deployment. A 5.3 file-read on a server whose .env holds a cloud key with broad permissions is, for you, a cloud compromise waiting to happen. We made a similar argument in why a 6.5 can matter more than a 9.9. When a file-read or SSRF flaw lands for an internet-facing app, ask what secrets that app can reach, and patch on that basis.

2. Patch and rotate, not just patch

If a file-read flaw was exposed before you patched it, assume the files were read. Patching stops the next request. It does nothing about a key copied last week. Rotate whatever the app could read, then look for use of the old credentials. Our post on why rotation isn't recovery covers what to hunt for after a secrets leak.

3. Get secrets out of files

The real fix is structural. On Azure, an app that uses a managed identity to reach Key Vault, storage and databases has no long-lived secret on disk to steal. Where a secret must exist, it belongs in a vault, fetched at runtime with an identity scoped to that one app, not in a .env file in the deployment folder. Our explainer on secrets management walks through the options. On the cloud metadata service, enforce token-protected access and limit what a managed identity can do, so an SSRF that reaches it gets as little as possible.

What to watch for

The good news is that harvesting is noisy and specific. The researchers' advice is to alert on path traversal through static and asset prefixes, because even a single hit against an internet-facing app is worth investigating. Requests for paths like these should never succeed on a production site:

  • /.env, /app/.env, /api/.env, /static/../.env
  • /proc/self/environ, /proc/self/cwd/.env
  • /.git/config, /.git-credentials, /.npmrc
  • /@fs/ paths aimed at a development server left exposed
  • anything pointing at 169.254.169.254

If your web apps sit behind Azure Application Gateway or Front Door with diagnostics sent to Sentinel, this query is a starting point to tune:

AzureDiagnostics
| where TimeGenerated > ago(14d)
| where Category in ("ApplicationGatewayAccessLog", "FrontDoorAccessLog")
| extend Uri = coalesce(requestUri_s, requestUri_s1)
| where Uri has_any (".env", "/proc/self/", ".git/config", ".git-credentials", ".npmrc",
                     ".aws/credentials", "/@fs/", "169.254.169.254", "laravel.log")
| summarize Requests = count(), Status = make_set(httpStatus_d), Paths = make_set(Uri, 10)
    by clientIP_s, host_s
| order by Requests desc

Most of what this returns will be automated scanning that got a 404, which is useful context but not an incident. A 200 response to any of these paths is an incident. Treat everything the file contained as compromised.

One more cheap control: put a canary credential in your .env files, a key that does nothing except raise an alert when someone uses it. If it fires, you know the file was read, even if you never saw the request. Our explainer on path traversal covers the most common bug behind these requests in more depth.

The shift for security teams

None of this makes code execution less serious. But the attacker who reads your .env and walks away with a cloud key may never touch your server again. Their next step is a sign-in from somewhere else, using credentials that are perfectly valid. That moves detection from the web server to identity and cloud logs, and it means the bugs at the bottom of your patch list may be the ones being used.

Our SOCs watch both ends of that chain: the web request that shouldn't have succeeded, and the valid credential used from the wrong place. If you want to know which of your internet-facing apps would hand over a key, our vulnerability and patch management service and offensive security testing are a good place to start. Or book a demo to see how we would investigate it.

Credential HarvestingSecrets ManagementPath TraversalSSRFVulnerability ManagementPatch PrioritisationManaged IdentityAzureMicrosoft SentinelKQL

Ready to see the agents work?

Book a demo of CYBERSHIELD AI against a real scenario.