Stanford Finds 1,748 Live API Keys Hiding in Plain Sight Across 9,804 Websites
A dynamic scan of 10 million websites uncovered 1,748 live API keys hiding in JavaScript bundles, with an average exposure of 12 months.
ProTakeaways
- Stanford, UC Davis, and TU Delft dynamically scanned 10M webpages and found 1,748 verified live API credentials across 14 services. Paper
- 84% of exposures live inside JavaScript, and 62% specifically inside Webpack-style bundles produced by build tools.
- Static repo scanning misses 95% of these leaks; they only appear after a browser renders the page.
- Credentials stay exposed for 12 months on average, with some persisting up to five years.
- Leaks included AWS keys for a Global Systemically Important Bank and full-repo GitHub access for a widely-used drone firmware maintainer.
- Coordinated disclosure removed 50% of exposed credentials within 14 days, though only 26% were properly revoked.
A team from Stanford, UC Davis, and TU Delft just ran what appears to be the first large-scale dynamic sweep of the live web looking for leaked API keys, and the results are unpleasant. Their measurement study pulled 10 million landing pages through a real browser, ran the responses through TruffleHog, and then validated every hit against the actual service API. In total, they identify 1,748 verified credentials across 9,804 websites and 5,693 distinct domains, sitting in plain sight on pages belonging to global banks, firmware maintainers, and top-ranked e-commerce sites.
The headline number is bad. The methodology finding is arguably worse: most of these leaks are invisible to the static repo scanners that the industry has been relying on for years.
Why static scanning has been missing the point
Prior work on secret leakage has focused on GitHub, Docker images, mobile apps, cloud buckets, and IPFS. A recent Truffle Security report looked at the web, but only through static CommonCrawl WARC archives. By relying only on static WARC files, that methodology captures only the initial HTTP response, limiting focus to a vector that this paper's data indicates accounts for only 5% of total web-specific exposures.
In other words, if you scan the raw HTML that a server returns, you see almost nothing. The credentials show up only after a browser executes the page, pulls in bundled JavaScript, and hydrates third-party scripts. The authors find that 62% of credential exposures in JavaScript files occur within bundles created by popular build tools such as Webpack. They note the number is likely higher because their analysis doesn't cover custom bundlers.

How the pipeline works
The team started from HTTP Archive's September 2025 crawl, which stores full HAR files (request URLs, response bodies, headers, and every resource loaded) for millions of sites. After filtering, the dataset consists of 11.9 million hostnames and 9.3 million domains, representing approximately 200 TB of data. The pipeline runs in three stages:
- Extract: Run TruffleHog v3.90.8 offline over every HAR file, decoding common Base64 and URL-encoded blobs so hidden credentials surface.
- Localize: Walk the HAR to record whether each match sits in a request URL, a response body, a bundled JS file, or the DOM.
- Validate: Re-run TruffleHog in verification mode, hitting non-destructive endpoints like AWS
GetCallerIdentity, GitHub/user, and Stripe/v1/charges. Only credentials that return a 200 count as verified.
They scoped validation to 14 services where a leak has real blast radius: AWS, Azure, Alibaba, Cloudflare, Stripe, Razorpay, Telegram, Mailchimp, SendGrid, Twilio, Slack, OpenAI, GitHub, and Bitly. Everything reported is therefore a lower bound.
What the leaks actually look like
The distribution across service types is worth staring at. AWS credentials alone represent more than 16% of all verified exposures and were found on over 4,693 websites. Telegram bot tokens had the cleanest signal, with roughly 85% of TruffleHog matches turning out to be real, because the token format is rigid. GitHub tokens were the opposite, with a true-positive rate near 0.0001% because the detector regex is broad enough to catch build artifacts and hashes.
The file-type breakdown drives the point home:
- The majority of exposures occur within JavaScript resources (84%), followed by HTML (8%) and JSON (7%) files, plus a verified GitHub token found sitting in a CSS file.
- 478 (5%) cases where credentials are hard-coded in the Document Object Model (DOM), indicating that credentials are directly embedded in the rendered page content.
- Most exposed credentials appear without substantial encoding, with 67% detected as PLAIN, 18% as ESCAPED_UNICODE, and 15% as BASE64.

They stay exposed for a very long time
Using nine historical HTTP Archive snapshots going back five years, the authors tracked how long each key stayed live. On average, exposed credentials remain publicly accessible for 12 months (min: 1; SD: 14; max: 60). Some services fare worse than others: Bitly credentials in particular linger, while AWS and Azure keys tend to disappear faster, likely because those providers run their own automated abuse detection.
Two case studies that should make you nervous
The paper includes two representative incidents that show why this matters beyond the aggregate stats:
- A Global Systemically Important Bank. The exposed credentials granted access to multiple AWS services, including Lambda, Relational Database Service, Secrets Manager, and Key Management Service. Manual inspection turned up further RSA private keys and OAuth2 credentials.
- A drone firmware maintainer. A leaked GitHub token belonging to a developer who ships firmware to multiple drone and radio-transmitter manufacturers. The exposed credentials granted full repository privileges for firmware distribution. An adversary obtaining these credentials could modify source code or firmware binaries, inject malicious functionality, or tamper with release artifacts distributed to downstream manufacturers.
What actually causes it
The disclosure phase is the most useful part of the paper for anyone shipping code. The team emailed 2,435 distinct entities and got real answers back from 40 organizations about root cause. The pattern that dominates is a specific misuse of bundler environment variables. Frameworks like Next.js, Nuxt, and Vite have public-prefix conventions (NEXT_PUBLIC_, NUXT_PUBLIC_, REACT_APP_) that mark which env vars are safe to inline into the client bundle. Plugins like @nuxtjs/dotenv, or a developer referencing process.env.APIKEY directly instead of a scoped config helper, can override that safety and bake every server-side secret into the browser-facing build.
Other common causes: test-time credentials that never got removed, legacy references left behind after a service was retired, and a surprisingly common belief that a "public" or "read-only" AWS key is safe to expose (it usually isn't, once cost-inflation attacks or data poisoning enter the picture).
Disclosure worked, mostly
After coordinated notifications, the total number of exposures reduced from 1,405 (Day 0) to 706 (Day 14), a removal of 50% of credentials by websites within the first 14 days. Revocations lagged removals by roughly 2x, suggesting many teams pulled the key from the page but left it valid on the backend, which is only half a fix.
What to take away
There's no released tool or model from this paper, it's a measurement study. But the operational implications are concrete. If your build pipeline scans source code but not the generated JavaScript bundle, you are checking the wrong artifact. The authors' recommendations map cleanly to CI/CD hygiene: allowlist which env vars can appear in bundles, run secret scanning on the compiled output (not just the repo), route sensitive API calls through a backend proxy, and stop treating "publishable" or "read-only" credentials as inherently safe. TruffleHog and Gitleaks both work fine on built artifacts. The gap isn't tooling, it's where teams point it.