How I Discovered Exposed .env Files on a Subdomain of a Popular
A subdomain of a proctoring platform served its .env file in plain text at a predictable endpoint, exposing internal diagnostic data and third-party service keys. An attacker could use these secrets to access the database or abuse third-party services.
Published on medium.com
As a penetration tester, I frequently encounter common misconfigurations that can lead to critical vulnerabilities. Recently, during a routine security assessment, I discovered that a prominent exam proctoring website had exposed its .env files.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
The exposed secrets could allow attackers to compromise the database or abuse third-party services, potentially causing data theft or financial loss.
What the attacker needed
None
The fix
The .env file should be made inaccessible by configuring web server rules and storing secrets in environment variables instead.
How it was found
- Enumerate subdomains of the target using tools like Amass and Subfinder.
- Use an endpoint extractor extension to collect links and API endpoints from JavaScript files.
- Identify the endpoint /v2/env from the extracted links.
- Probe all subdomains with httpx using the path /v2/env and open the valid URLs.
- Observe that the server returns the .env file in plain text.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A .env file is a configuration file that often holds secret keys and passwords for an application. If a website accidentally makes this file publicly downloadable, anyone can read those secrets and potentially break into the system or misuse paid services.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.