Never bake API keys or .env files into a container image; pass them at runtime, and if one ever went into a public image, rotate it now even if you deleted the tag
Study: AWS, OpenAI and Anthropic keys left in public Docker Hub images were used within seconds · Security incident · BleepingComputer · BleepinComputer · Nov 17, 2026
What happened
Stony Brook University researchers Billy Tsouvalas and Nick Nikiforakis presented results at ACM CCS (reported by BleepingComputer on 17 Nov 2026) from 300 honeypot images published across eight public container registries over four months, seeded with AWS, OpenAI and Anthropic API keys plus decoy SSH and database credentials. The images were pulled more than 75,000 times and the planted AWS keys received over 140,000 API calls from 5,000 unique IPs. The fastest AWS key use came 7.86 seconds after publication on Docker Hub, the median first call came after about 51 seconds, and all 100 AWS keys were used within 15 minutes. The OpenAI and Anthropic keys were quickly drained of their test balances. Scanners mostly pulled secrets straight out of image layers without ever running the containers. The researchers say they reported it to Docker in May and saw no changes in an August re-test.
How to prevent it
Keep secrets out of Dockerfiles, build args and copied .env files, add .env to .dockerignore, scan images for secrets before pushing, inject keys at runtime from your host's secret store, and set spend limits on every AI provider key.
Fix prompt for your own AI tool
Copy this into your own AI tool (Cursor, Lovable, Claude Code, Bolt…). It's general guidance written by us. Review what the AI suggests before applying it.
I'm a beginner and want to make sure my API keys are safe in my Docker project. 1) Search the code for hardcoded keys or tokens and for secrets in variables that ship to the browser (NEXT_PUBLIC_, VITE_, REACT_APP_). List the file and line, but don't print the values. 2) For each one, tell me whether it's meant to be public (like a Supabase anon key) or secret. 3) For secret ones, show me how to move them to server-side env vars and call the provider through a server route. 4) Give me the steps to rotate each exposed key in the provider's dashboard and set a spending limit. 5) Make sure .env is in .gitignore and in my AI tool's ignore file. Don't change anything until I've approved your plan. Never ask me to paste API keys, passwords or .env contents; tell me where to check them myself.
Why this keeps happening: leaked secrets & api keys
Secret keys placed in front-end code, mobile bundles or public repositories can be found by automated scanners and abused, often running up large bills on AI or cloud accounts before anyone notices.
A quick checklist before you ship
- Keep secret keys only in server-side environment variables, never in browser or app code.
- Set spend limits and usage alerts with every AI and cloud provider.
- Turn on secret scanning and push protection for your repositories.
- If a key leaks, revoke and replace it first; deleting the file is not enough.
More on this: every leaked secrets & api keys story and our related guide.
Tools involved
Docker stories, OpenAI stories, Anthropic stories
Related stories
- Put hard spend caps and scoped keys on every AI provider account
Google: hijacked AI keys and cloud tokens ran up as much as $1 million in charges before access was cut - Roll every secret you stored in Railway
Railway: intruder may have read customer environment variables - Rotate any AI key you saved in a hosted tool
OpenCode Console breach: saved AI provider keys may be exposed
Source: original post on BleepingComputer ↗. Summarised in our own words; numbers are as stated by the source. Browse all stories.