In a honeypot study presented at ACM CCS, bots used a decoy AWS key 7.86 seconds after the Docker Hub image that contained it was published. The median was 51.19 seconds, and all 100 planted AWS keys were used within 15 minutes. If a real key has ever shipped inside a public image, even briefly, treat it as compromised. Revoke it first, then review what it did, then rebuild the image without it. The lasting fix is to keep secrets out of images entirely and inject them when the container starts.
I did not reproduce the study. Everything below about its results comes from the reporting linked at the end. The Docker steps are standard practice, and the Ennote steps follow our documentation as I read it on November 19, 2026.
What the study measured
Two Stony Brook University researchers, Billy Tsouvalas and Nick Nikiforakis, published 300 honeypot images across eight public container registries over four months, according to BleepingComputer's report from November 17, 2026. They contained AWS, OpenAI and Anthropic API keys, plus decoy SSH and database credentials. The paper is titled "Gone in 8 Seconds: Uncovering Malicious Bots Operating on Public Container Registries."
| Measure | Result |
|---|---|
| Image pulls | more than 75,000 |
| API calls on planted AWS keys | more than 140,000, from 5,000 unique IP addresses |
| Fastest first use of an AWS key | 7.86 seconds after publication |
| Median time to first AWS call | 51.19 seconds |
| AWS keys used within 15 minutes | all 100 |
| OpenAI and Anthropic keys | used to exhaust the balances of the test accounts |
Two details change how you should respond:
- The bots mostly read layers, not run containers. Almost nobody started the images. Scanners pulled them and inspected the layers directly. So "we never run it as root" or "the entrypoint overwrites that file" does not help: the key is in the layer.
- Docker Hub drew nearly all the AWS activity, and Harbor also saw some abuse. One caveat from me: 300 fresh honeypot images with controlled keys say nothing about how many real public images contain secrets, and a real leaked key may be found faster or slower than these times.
The researchers reported the problem to Docker in May. Per BleepingComputer, they got only an acknowledgment, and an August test showed no platform change. Waiting for the registry to protect you is not a plan.
How keys end up in images
Most of these leaks are mundane. The usual paths:
COPY . .copies a.envfile or a cloud credentials file into the image.ENV API_KEY=...orARG API_KEY=...in the Dockerfile. Both are recorded in image metadata and layers, and anyone who can pull the image can read them withdocker historyor by unpacking it.- A
RUNstep that writes a key to a file and a later step that deletes it. The deletion adds a new layer on top, and the earlier layer still contains the file. - A token passed at build time and left in a build cache or in a pushed intermediate image.
If a key shipped in an image: response order
I'd do these in this order, and I would not wait to confirm that the image was scraped.
- Make the image private or delete the tag. This stops new pulls. It does not undo pulls that already happened, so do not stop here.
- Revoke the key at the provider. For AWS, deactivate or delete the access key; for OpenAI or Anthropic, delete the key in the provider console. Create the replacement after the old key is dead, not before. This happens at the provider, and no secret manager can do it for you.
- Review what the key did. On AWS, look at your CloudTrail history for that key ID, and check for new IAM users, access keys, roles or running instances that you did not create. For AI providers, open the usage and billing pages for spikes.
- Find every other secret in the same image. Unpack it and look at all layers, not only the final filesystem. Rotate everything you find, including database passwords and SSH keys.
- Rebuild without the secret and push a new tag. Old tags and digests that still contain the key must be deleted from the registry, or the key stays one
docker pullaway. - Record what was exposed and when, so the next review has a starting point.
For the AI-key version of steps 2 and 3, see what to do in the first hour after a leaked key.
Stop baking secrets in: three rules
- Nothing sensitive in the build context. Add
.env, credentials files and key files to.dockerignore. - No secrets in
ENVorARG. If a build step really needs a credential, use BuildKit secret mounts (RUN --mount=type=secret,...), which do not persist in the final image layers. See the Docker documentation for the syntax. - Inject at runtime. The image holds code. Secrets arrive when the container starts, from outside.
Rule 3 is where people fall back to a .env file next to the Compose file. That is the same leak waiting for a different mistake: the file gets committed, copied into an image, or pasted into chat. We built Ennote to remove this problem, and the next section shows how to do it for Docker.
How to do this with Ennote
At Ennote, we document three ways to give a container its secrets without a .env file and without putting them in the image. The first two need the Ennote CLI only on the host that runs Docker. All commands below are from the Docker guide and the CLI quickstart.
Step 1: store the secret once
Sign in on your machine (ennote auth). It opens your browser for SSO (OAuth 2.0 PKCE) and keeps the token in the OS keyring:
ennote auth login
ennote config set organization-id my-org-id
ennote config set workspace-id my-workspace-id
Create the secret. Piping through stdin keeps the values out of your shell history (ennote secret create):
cat .env | ennote secret create "app" --type KEYS_VALUES
Then delete the local .env. If your keys are in a password manager export, ennote secret import supports 1Password, LastPass and Bitwarden files, with --dry-run to preview.
Step 2: run the container with injected secrets
Option 1, docker run. ennote secret get <secret> -- <command> starts the command with each key of the secret as an environment variable. -e NAME without a value copies that variable from the Docker CLI's environment into the container (ennote secret get):
ennote secret get app -- docker run --rm -e DB_PASSWORD -e API_KEY my-image
Here app is a secret with the keys DB_PASSWORD and API_KEY. Per the docs, the values are never written to a file or typed on the command line.
Option 2, Docker Compose. List the keys under environment without values:
services:
api:
image: my-image
environment:
- DB_PASSWORD
- API_KEY
ennote secret get app -- docker compose up -d
Option 3, the CLI as the entrypoint, for platforms that start containers for you and let you set environment variables but not wrap the start command:
FROM alpine:3.20
RUN apk add --no-cache curl \
&& curl -sSfL https://get.ennote.io/get-cli.sh | sh
COPY app /app
ENTRYPOINT ["ennote", "secret", "get", "app", "--"]
CMD ["/app/server"]
docker run --rm \
-e ENNOTE_TOKEN -e ENNOTE_ORGANIZATION_ID=org_123 -e ENNOTE_WORKSPACE_ID=wrk_prod \
my-image
The docs are explicit about the one trap here: never put ENNOTE_TOKEN in a Dockerfile (ENV or ARG), because it would be stored in the image layers. That is the mistake this article is about, with a different token. For automated environments the token is a machine identity token or Personal Access Token (token guide). You can create up to 10 active tokens, each must expire (1 hour up to a maximum of 30 days), and you can revoke one immediately from the dashboard.
For Kubernetes, the docs point to the Ennote Kubernetes agent instead, which syncs secrets into native Kubernetes Secrets.
Step 3: check that it worked
- Run
docker history my-imageanddocker run --rm my-image env. The first lists layer metadata and the second prints the environment baked into the image. Neither should show a key. If either does, it is still in the build. - Search the repository and build context for
.envfiles:git ls-files | grep -i envand a look at your.dockerignore. - Open the secret in the Ennote web app and look at its version history. Ennote saves a new version on every change, with timestamp and user, and you can revert to an earlier one. So when you rotate a key after a leak, you can see which value was live when.
- On the Team plan, audit logs record secret creation, access, share, modification and deletion in shared workspaces (retention depends on plan; the secret manager page lists 30 days for Team). You can get notified about events.
What this does not do
- Our documentation describes no image or registry scanning, and Ennote does not revoke an AWS, OpenAI or Anthropic key at the provider. Steps 2 and 3 of the response order stay manual.
- It does not stop a mistake that bypasses it. If someone still hardcodes a key in a Dockerfile, the key is in the image. Pair Ennote with a secret scanner in CI, and see the CLI overview for how it fits in a pipeline.
- Once the variables are inside a running container, the application and anyone with access to that container can read them. Limit who can run
docker execanddocker inspecton your hosts.
You can create a free workspace on the Developer plan to try the commands above.
What I'd change first
If I had one afternoon: add .env and key files to .dockerignore, grep every Dockerfile for ENV and ARG lines that hold credentials, and move the runtime secrets out of Compose files. Then scan the images you already pushed. An image you published months ago is as readable today as it was on day one.
Sources
- BleepingComputer, Cloud keys leaked in Docker Hub images are stolen within seconds, November 17, 2026
- Ennote documentation: Docker guide, CLI quickstart,
ennote secret get,ennote secret create,ennote auth, Personal Access Tokens, Secret Versions, Audit Logs

