Forgotten Serverless History: Finding Exposed AWS Keys & .env Files on pages.dev via SSL Assignation
How forgotten serverless deployment histories and dev/preview subdomains (*.pages.dev, *.workers.dev, preview builds) leak live AWS keys and .env secrets—and how checking SSL certificate assignation exposes historical deployments that developers never deleted.
1. The Discovery: Why Serverless History Is Dangerous & Forgotten
Modern developers deploy web applications on serverless platforms (*.pages.dev, *.workers.dev, *.vercel.app, *.netlify.app) because every push automatically builds and publishes a live URL. What most developers forget—or do not care to clean up—is that serverless platforms keep an immutable history of old deployments and dev / preview URLs live on the internet.
During security research, Midas discovered a critical, widespread vulnerability pattern across serverless deployments:
- Developers Push a Fix Instead of Deleting History: A developer accidentally deploys a build containing a
.envfile, hardcoded AWS keys (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY), or internal API tokens. Ten minutes later, they remove the secret in a new commit and redeploy. Production (example.com) now looks clean—but the old deployment is still online in the serverless history (<hash>.<project>.pages.devordev.<project>.pages.dev), and the developer never deleted the deployment history or rotated the AWS keys. - Finding Hidden
pages.dev&devDeployments via SSL Assignation: Even when a company hides its.pages.devordevURL behind a custom domain, checking SSL certificate assignation (Certificate Transparency logs / SAN records) reveals the underlyingpages.dev,dev, and branch preview hostnames where.envfiles and AWS credentials are still exposed.
2. How SSL Assignation Reveals Forgotten pages.dev & dev Deployments
Whenever a developer creates a project on a serverless platform, connects a custom domain, or spins up a dev / staging branch, the platform automatically issues TLS/SSL certificates (via Let's Encrypt, Google Trust Services, or DigiCert). Every issued certificate is permanently recorded in public Certificate Transparency (CT) logs.
By checking SSL assignation, a researcher can map the entire forgotten surface of an application in seconds:
- Correlating Custom Domains to
pages.dev/devNames: Developers almost always name their serverless project after their brand or repository (<company>.pages.dev,<company>-dev.pages.dev,staging-<company>.pages.dev). Checking SSL certificate assignation history surfaces every certificate ever issued for their staging,dev, and preview subdomains. - Enumerating Branch & Commit Previews: When wildcard or branch certificates are assigned (
*.<project>.pages.devor<branch>.<project>.pages.dev), CT logs record the exact hostnames where early, unhardened builds were deployed before security checks were added. - Bypassing the Main Domain Entirely: Even if the main domain (
app.company.com) is protected by strict WAF rules or serves a sanitized latest build, the underlyingpages.devordevhostname discovered through SSL assignation responds directly with the uncleaned build or historical deployment.
3. Why .env Files & AWS Keys Survive in Serverless History
When auditing pages.dev and dev endpoints discovered via SSL assignation, leaks consistently happen for three reasons:
- People Don't Delete Deployment History:
- On platforms like Cloudflare Pages, Vercel, and Netlify, every previous deployment remains online at its unique deployment URL unless an administrator explicitly deletes the deployment or locks previews behind an access policy.
- When a developer accidentally commits a
.envfile or hardcodes an AWS key during initialdevtesting, simply pushing a new commit (git rm .env) only updates the latest build—the old deployment URL still serves the leaked.envand AWS keys.
- Static Asset & Bundler Leakage on
devBranches:- Early
devdeployments frequently publish raw project directories (where/.env,/.env.local, or/.env.productionis served directly as a static file) or include unminified JavaScript sourcemaps (*.js.map) that contain full.envobject dumps and AWS S3 / IAM credentials.
- Early
- Unrotated Cloud Keys:
- Because developers assume that removing the key from their latest commit fixed the issue, they almost never revoke or rotate the leaked
AWS_ACCESS_KEY_IDin AWS IAM—leaving live cloud infrastructure wide open to anyone who checks their serverless history.
- Because developers assume that removing the key from their latest commit fixed the issue, they almost never revoke or rotate the leaked
| Exposure Point | How It Is Found | What Developers Forget | Impact |
|---|---|---|---|
*.pages.dev / dev Subdomains | SSL Assignation (CT Logs) | Preview and dev URLs stay public even after a custom domain is added | Direct bypass of production domain to reach forgotten dev builds |
| Immutable Deployment History | Preview / Branch URLs | Pushing a new commit does not delete previous serverless deployments | Old builds with accidental .env or key leaks remain online forever |
Leaked .env & Sourcemaps | Inspecting dev / Old Builds | Early test builds often ship raw .env files or .js.map sourcemaps | Full disclosure of environment variables and backend endpoints |
Hardcoded AWS Keys (AKIA*) | Scanning JS Chunks & .env | Removing a key in Git/production does not invalidate the key in AWS IAM | Live compromise of AWS S3 buckets, Lambda, SES, or EC2 infrastructure |
4. How to Actually Lock Down Serverless History
Fixing a leak in your latest commit is useless if your serverless history is still public:
- Lock
*.pages.dev& Preview URLs Behind Authentication: Enable Cloudflare Access (or deployment protection) on all*.pages.devand preview deployments so public visitors can only access the current production custom domain. - Delete Old Deployment History: Whenever a build accidentally includes a
.envfile, sourcemap, or secret, delete the historical deployment records on the serverless platform—do not just push a new commit on top of it. - Immediately Rotate Exposed AWS Keys: Treat any credential that ever touched a
devor preview build as compromised. Revoke theAWS_ACCESS_KEY_IDin AWS IAM immediately, because SSL assignation and serverless history make "hidden" preview builds trivial to find.
Technical References & Verification
crt.sh — Certificate Transparency Log Search & SSL Assignation Auditing
Public Certificate Transparency search engine used to inspect SSL certificate assignation and enumerate forgotten subdomains and dev/preview endpoints.
Securing Cloudflare Pages Preview Deployments (*.pages.dev) with Cloudflare Access
Official guide on restricting public access to historical and branch preview deployments on *.pages.dev.
AWS IAM Best Practices — Rotating and Revoking Exposed Access Keys
AWS security documentation on immediately deactivating and rotating IAM access keys exposed in builds or repositories.
