Today's topic: secrets. Because this week, the stolen credential was the story almost every day. 1Password, Todoist, SAP, Hex.pm. Different companies, same raw material.
So here's a study that should change how fast you think "leaked" turns into "used."
The Experiment
Researchers Billy Tsouvalas and Nick Nikiforakis at Stony Brook University published 300 decoy container images (copies of the official nginx image with planted credentials) across eight registries, including Docker Hub, Amazon ECR and Red Hat Quay, over four months. The fake secrets included AWS keys, AI provider API keys, and SSH and database credentials. Per Help Net Security and Cyber Security News:
- Fastest AWS key use: 7.86 seconds after the image was pushed to Docker Hub.
- Median: about 51 seconds. 93% of AWS keys were used within five minutes. All of them within fifteen.
- Across the study, the AWS keys drew over 140,000 API calls from more than 5,000 IP addresses.
- The bots never ran the images. They read the public catalog of recently pushed images, grabbed manifests, and downloaded only the layers containing credentials.
- Attackers followed a validate, wait, exploit pattern: check the key works, then come back later. AI API keys were drained of credits. One key was abused about a month after the last push.
- Images with juicy-sounding names drew more than twice the pulls.
The researchers' summary, via Help Net Security: "publication and compromise are, for practical purposes, the same event."
What That Means
If your mental model is "we'll catch it in the next scan and rotate it," you've already lost. There is no window. And deleting the image doesn't help, because the key was copied before your coffee finished brewing.
It also connects the dots on this week. A developer's token, a CI secret, a key baked into a build layer: they're all just strings, and attackers have built industrial pipelines to find and test strings.
Disclosure: I work at Zscaler. I'm biased toward a world where a stolen key alone isn't enough, because access also checks who and what is using it. But the first fixes here are free and belong in every pipeline.
What To Do
- Never put secrets in image layers. Not in ENV, not in ARG, not in a file you "delete" in a later layer (it's still in the earlier one). Use BuildKit secret mounts.
- Scan images before push, layers and metadata included, not just your source repo. Block the push on a hit.
- Prefer short-lived credentials. IAM roles, workload identity, OIDC from CI. A key that expires in an hour is a much worse prize.
- Scope keys tightly. In round two of the study, restricted keys couldn't be used for anything expensive. Least privilege actually worked.
- When a key leaks, revoke first, investigate second. Then review CloudTrail (or your provider's equivalent) from the moment of publication, not from when you noticed.
- Treat AI API keys like cloud keys. They're billing credentials, and attackers are draining them.
- Watch for "who am I" calls from unfamiliar IPs. Validation is the first thing attackers do, and it's your earliest warning.
Bottom Line
Public means compromised, and fast. Design so secrets never reach an artifact, expire quickly if they do, and can't do much on their own. Then this week's headlines get a lot more boring.
Sources: Help Net Security, Cyber Security News