How Bots Steal AWS Keys From Public Docker Hub Images, and How to Stop Them

On November 17, 2026, A study that every cloud and DevOps team should read twice. Billy Tsouvalas and Nick Nikiforakis of Stony Brook University published 300 instrumented honeypot images across eight public container registries over four months. The images carried planted AWS, OpenAI and Anthropic API keys plus decoy SSH and database credentials. The work, titled "Gone in 8 Seconds: Uncovering Malicious Bots Operating on Public Container Registries," was presented at the ACM Conference on Computer and Communications Security (CCS).
The result is blunt. Automated bots found the images, extracted the keys and tried them almost immediately. This is not a Docker Hub breach and not a software vulnerability. It is a measurement of how little time a defender has between a secret reaching a public registry and an attacker using it.
A note on the numbers. Coverage quotes different totals because it draws on different scopes. BleepingComputer reports study-wide totals (75,000+ pulls, 140,000+ AWS calls, about 5,000 IPs). Cyber Security News cites first-round figures that appear narrower: 58,819 downloads of 100 unadvertised Docker Hub images and 66,321 AWS requests from 3,842 IPs. The IP counts show where requests came from, not how many attackers exist.
There is also an accountability gap. The researchers say they reported the findings to Docker in May, received an acknowledgment but no follow-up, and saw no platform changes in a small retest in August. That is their account, and no Docker response is on the record. They recommend that Docker Hub scan images for secrets before publication and rate-limit its public feed of newly published or updated images.
How Bots Extract and Abuse Secrets From Container Image Layers
An image is not a black box. It is a manifest, a configuration file and a stack of compressed filesystem layers, all served over the registry API. A bot never has to start the container. It can download each layer, unpack it and search the files and metadata for secrets. The researchers' beacons, which report when an image is built or run, barely fired, which is strong evidence that extraction is static.
Why deleting the file does not help
Layers are additive. If a build step copies .env into the image and a later step runs rm .env, the final filesystem looks clean but the earlier layer still contains the file. Secrets passed with ARG or ENV are worse: they persist in the image configuration and build history, where docker history --no-trunc prints them. Docker's own documentation warns that build arguments and environment variables are inappropriate for secrets because they persist in the final image.
The attack chain, step by step
The study groups the first calls from each source IP into three phases: check, explore and exploit. Combined with how bots must work to hit the observed timings, the chain looks like this.
The user agent tag is spoofable, so it suggests rather than proves that TruffleHog-style verification is in use. The per-call figures come from an independent analysis of the researchers' published CloudTrail data (146,630 calls from 5,150 hashed IPs), not from the paper itself, so treat them as indicative.
Why GetCallerIdentity is the attacker's favorite first call
sts:GetCallerIdentity needs no IAM permission, and an explicit deny in a policy does not block it. That makes it a free, silent way to confirm that a stolen key works and to learn the account ID and principal. For defenders it is also a gift: a GetCallerIdentity call from an unfamiliar IP, using a key that normally runs only from your build system, is one of the highest-signal events in CloudTrail.
Beyond Docker Hub
Docker Hub is one leak path among many. Truffle Security's August 2026 research collected 431,875 AWS secrets from Git history, Hugging Face datasets, Docker images, package registries and CI logs, and reduced them to 64,024 unique keys tied to 50,654 AWS accounts. The same bots that watch one feed almost certainly watch the others.
What the Honeypot Data Tells Us: Loginsoft Threat Intelligence Analysis
Read as a timeline, the data shows why detection alone cannot win this race.
What we take from it. First, only prevention at build time reliably wins. Once the image is public, the median attacker is faster than the median responder, so detective controls should be designed to limit blast radius rather than to prevent first use. Second, least privilege worked: three quarters of the bot calls were denied. Scoped keys turned a potential takeover into noise. Third, the targets point to monetization. Email-sending and AI-inference calls indicate spam infrastructure and resale of stolen model access, which matches the wider pattern of cloud-key abuse for mining and abuse of paid services.
This is a systemic problem, not an outlier. A 2023 RWTH Aachen study of 337,171 Docker Hub images and 8,076 images from other registries found that 8.5% contained secrets, including 52,107 private keys. Flare analyzed Docker Hub uploads from November 2025 and found 10,456 images with exposed keys across 205 namespaces, with 101 companies identified behind the leaks. Truffle Security found 768 live corporate AWS keys with full control of an account, made up of 526 root keys and 242 IAM users with Administrator Access.
Limits of the study, stated plainly. The keys were decoys with restricted permissions. The bots are a loose umbrella the authors call Container Bots, with no evidence of one operator or a named threat actor. The 7.86 seconds is a best case, not the average. The study reports activity mainly on Docker Hub and Harbor and gives no breakdown for the other six registries, so it cannot show that they are safe.
At Loginsoft, we have analyzed more than 20,000 CVEs and discovered more than 1,000 zero-days, and one lesson from that work applies directly here: attackers industrialize whatever is cheap to automate. A leaked key is the cheapest foothold there is, and it often leads straight to the unpatched, internet-facing workloads where the real damage happens.
How to Keep Secrets Out of Public Registries and Respond if One Leaks
1. Stop secrets entering images
- Use BuildKit secret mounts. Never use
ARGorENVfor credentials. - Add a
.dockerignorethat excludes.env,.aws, key files and config with tokens. - Scan the built image, including layers and metadata, in CI and fail the pipeline on a finding before any push.
- Default new repositories to private and require approval to publish publicly.
# syntax=docker/dockerfile:1
FROM python:3.12-slim
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
aws s3 cp s3://my-bucket/model.bin /models/model.bin
# build: the secret is available only for that RUN step
docker build --secret id=aws,src=$HOME/.aws/credentials -t myorg/app:1.0 .
# scan the finished image before pushing
trufflehog docker --image myorg/app:1.0 --only-verified
trivy image --scanners secret myorg/app:1.0
docker history --no-trunc myorg/app:1.0 # look for ARG/ENV leaks 2. Limit the blast radius
- Replace long-lived IAM user keys with roles that issue temporary credentials, and use OIDC federation for CI instead of stored keys.
- Delete all root access keys. Scope every remaining key to the minimum actions and, where possible, to expected networks or VPC endpoints.
- Use service control policies to block
iam:CreateAccessKeyoutside approved roles, and set AWS Budgets and cost anomaly alerts. - Set hard spend limits on OpenAI, Anthropic and other AI provider keys.
3. Detect abuse early
- Enable GuardDuty and review IAM findings such as
Discovery:IAMUser/AnomalousBehavior. - Alert on
GetCallerIdentityfrom IPs outside your known ranges, bursts of AccessDenied, and first-time use of SES or Bedrock by a key.
# CloudWatch Logs Insights over CloudTrail
fields @timestamp, eventName, sourceIPAddress, errorCode, awsRegion
| filter userIdentity.accessKeyId = "AKIAXXXXXXXXXXXXXXXX"
| sort @timestamp asc 4. If a key was exposed, run this playbook
- Deactivate the key now. Do not wait to confirm abuse.
aws iam update-access-key --user-name <user> --access-key-id <AKIA...> --status Inactive - Check last use.
aws iam get-access-key-last-used --access-key-id <AKIA...>shows the service, region and time. - Review CloudTrail from the publish time. Look for unfamiliar IPs,
CreateUser, CreateAccessKey, AttachUserPolicy, UpdateAssumeRolePolicy, and anyRunInstances, SES or Bedrock activity in every region, including ones you never use. - Remove what the attacker created, then rotate any secret the key could read, such as Secrets Manager and Parameter Store values.
- Replace the key with a role if the workload still needs access, then delete the old key.
- Delete the image and all tags, but assume copies exist. Removal never invalidates a key.
- Fix the pipeline so the same secret cannot ship again, and add the scan gate from step 1.
One caution. AWS can attach the AWSCompromisedKeyQuarantineV3 managed policy to an exposed IAM user, which denies certain actions. It does not revoke the key, so it is a safety net and not a substitute for rotation.
How Loginsoft Helps You Find, Prioritize and Close Credential Exposure Risk
A leaked key is not a CVE, so a vulnerability feed will not list it. Our role is to shrink the exposure around it: find what is publicly reachable, show which weaknesses an attacker would chain next, and give your team early warning of the scanning behavior behind events like this one.
With roughly 18 years of IT engineering history and more than 6 years focused on cybersecurity, our team works across both sides of this problem: engineering the pipeline controls and researching how attackers abuse what slips through.
FAQs: Exposed AWS Keys and Secrets in Docker Hub Images
Q1. How fast do attackers steal AWS keys from public Docker Hub images?
In a Stony Brook University honeypot study, the fastest use of a planted AWS key came 7.86 seconds after the image was published on Docker Hub. The median time to the first API call was 51.19 seconds, and all 100 planted AWS keys were used within 15 minutes.
Q2. Do attackers need to run a container to steal secrets from it?
No. The researchers found that scanners mostly extract credentials through static analysis, by unpacking image layers or querying the registry API. The images were rarely built or run, so secrets can be stolen without ever starting the container.
Q3. Does deleting a Docker image or a file remove the exposed secret?
No. A file deleted in a later build step still exists in an earlier image layer, and removing the image does not invalidate copies already pulled. The only reliable fix is to deactivate or rotate the exposed credential.
Q4. What should I do if I pushed an AWS access key to Docker Hub?
Treat the key as compromised. Deactivate it immediately, review CloudTrail from the publish time for unfamiliar calls, IAM changes and new resources in every region, replace the key with a role that issues temporary credentials, and then fix the build so the secret never enters the image.
Q5. How do I keep secrets out of Docker images?
Use BuildKit secret mounts (RUN --mount=type=secret) instead of ARG or ENV, inject runtime secrets from a secrets manager, add a .dockerignore for env and credential files, and scan every built image for secrets in CI before it is pushed to any registry.
Q6. Is this a Docker Hub vulnerability or a CVE?
No CVE has been assigned. The study did not report a break-in at Docker Hub. It shows that secrets published in public images are harvested within seconds, which is a credential hygiene and pipeline control failure rather than a software flaw.
Q7. Does AWS automatically protect exposed access keys?
AWS can attach the AWSCompromisedKeyQuarantineV3 managed policy, which denies certain actions on an exposed IAM user key. It does not revoke the key, and it can arrive after bots have already validated it, so rotation is still required.
Q8. How can I detect stolen AWS keys in CloudTrail?
Filter CloudTrail by the exposed access key ID and look for sts:GetCallerIdentity from unfamiliar IP addresses, bursts of AccessDenied errors, enumeration calls, and IAM or SES activity that the key never performed before. Pair this with GuardDuty and AWS budget alerts.
Q9. Which keys do bots go after besides AWS?
The study also planted OpenAI and Anthropic API keys, and bots quickly drained the test balances. Any API key that bills per use, including cloud AI services, should be treated as a target when it appears in a public image.
Sources
- Cyber Security News: Hackers steal exposed AWS credentials
- WindowsForum: Docker Hub honeypot study summary (paper title and mitigation notes)
- Blogspan: independent analysis of the study dataset
- Truffle Security: 768 Leaked Corporate AWS Keys Held Full Admin Rights
- Flare: Thousands of Exposed Secrets Found on Docker Hub
- RWTH Aachen: Secrets Revealed in Container Images
- Docker Docs: Build secrets
- Docker Docs: SecretsUsedInArgOrEnv build check
- AWS Docs: AWSCompromisedKeyQuarantineV3 managed policy






