Docker Hub image secrets hijacked by automated scanners within seconds of publication
TL;DR
Attackers are extracting cloud credentials from public container images on registries like Docker Hub within seconds of publication. Developers embedding AWS, OpenAI, or Anthropic keys in images are at high risk. Scan all images for secrets before pushing to public registries.
What happened
Researchers from Stony Brook University monitored 300 honeypot images across eight public container registries over a four-month period. These images contained decoy AWS, OpenAI, and Anthropic API keys, alongside SSH and database credentials.
The study found that automated scanners, which the researchers called "ContainerBots," extract secrets through static analysis by unpacking image layers or querying registry APIs. This method allows attackers to steal credentials without ever running the container. On Docker Hub, the fastest observed use of an AWS key occurred just 7.86 seconds after the image was published. The median time for the first API call was 51.19 seconds, and all 100 planted AWS keys were utilized within 15 minutes. The AWS keys alone drew over 140,000 API calls from 5,000 unique IP addresses.
Why it matters
The speed of exploitation is the primary concern. Because attackers use static analysis to inspect image layers directly, they can hijack credentials before a human even realizes a push was successful. The researchers noted that while the scans showed no evidence of coordinated operators, the automation is highly effective at exhausting API balances and consuming cloud resources. This creates a massive window of vulnerability for anyone hardcoding secrets into their container builds.
Who is affected
- Developers embedding AWS, OpenAI, or Anthropic credentials in container images.
- Users publishing images to public registries, specifically Docker Hub and Harbor.
What to do now
- Scan all container images for embedded secrets before pushing them to public registries.
- Rotate any credentials that may have been included in recently pushed images.
- Use secret management tools instead of hardcoding credentials in image layers.
- Monitor cloud provider logs for unauthorized API calls or unexpected resource consumption.
What we don't know yet
- The exact number of real-world victims affected by this credential extraction method.
- Whether the "ContainerBots" are coordinated or independent actors.
- The full extent of the automated scanning infrastructure used by attackers.
