Docker Hub Secrets Are Stolen in Seconds

Docker Hub leaked secrets can be found and abused almost immediately: researchers observed a planted AWS key used just 7.86 seconds after publication in 2026. All 100 AWS keys tested on Docker Hub received an API call within 15 minutes. A leaked container secret is a credential embedded in an image or layer that unauthorized scanners can extract and use.

How quickly are Docker Hub leaked secrets exploited?

Docker Hub leaked secrets were exploited in as little as 7.86 seconds during a 2026 Stony Brook University study. The median delay before the first API call was 51.19 seconds, and every one of the 100 planted AWS access keys on Docker Hub was used within 15 minutes of publication.

Researchers Billy Tsouvalas and Nick Nikiforakis published 300 honeypot images across eight public container registries during a four-month experiment. Their paper, Gone in 8 Seconds: Uncovering Malicious Bots Operating on Public Container Registries, was presented at ACM CCS 2026 on November 16, 2026.

Observed exploitation of planted AWS keys on Docker Hub in 2026
Measurement Observed result What it means for responders
Fastest first use 7.86 seconds in 2026 Manual deletion cannot reliably beat automated collection
Median first API call 51.19 seconds in 2026 Half of the keys were used in under a minute
All tested AWS keys used 100 of 100 within 15 minutes in 2026 Even a short public exposure must be treated as compromise
AWS-key traffic More than 140,000 calls from over 5,000 unique IP addresses in 2026 Abuse was distributed rather than limited to one scanner

The scale matters as much as the speed. The honeypot images accumulated more than 75,000 pulls in 2026, while planted AWS credentials generated over 140,000 API calls from more than 5,000 unique IP addresses. The experiment also included OpenAI and Anthropic keys, decoy SSH credentials, and database credentials; exposed AI-service balances were exhausted.

BleepingComputer reported on November 17, 2026, that Docker Hub accounted for nearly all observed AWS-key activity. Harbor was the only other tested registry reported to show AWS-key abuse. That finding shouldn’t be read as proof that another public registry is safe; it describes what this experiment observed.

How do scanners find secrets without running the container?

Automated scanners find Docker Hub leaked secrets by inspecting image layers and registry data rather than starting containers. Runtime beacons rarely fired during the 2026 honeypot study, indicating that scanners generally downloaded or queried image contents, searched static files for credential patterns, and attempted valid-looking keys through provider APIs.

See also  Why Cloud Services and Security Must Evolve Together

A public image is structured data. Its manifest points to downloadable layers, and those layers can expose shell history, configuration files, package-manager settings, copied source trees, private keys, and credentials used during a build. Attackers can process that material at machine speed.

The low runtime-beacon rate closes an easy monitoring blind spot. If your alerting watches only for a container being launched, you may never see the collection step. The first visible event could instead be an AWS API request, an AI API charge, or access to an external database.

That speed resembles other forms of automated exploitation, including the rapid scanning described in coverage of PHP2Shell exploitation in the wild. Public exposure creates a race that defenders shouldn’t expect to win manually.

Why doesn’t deleting a secret in a later Docker layer work?

Deleting a credential in a later Dockerfile instruction does not remove the credential from an earlier immutable layer. Docker presents the final filesystem as a combined view, but layer-aware tools can retrieve the original file from image history. GitGuardian documented this container-secret pitfall during research published between 2020 and 2026.

Consider a build that copies an entire project directory, runs a package installation requiring a token, and then deletes the token in a later RUN instruction. The finished container may no longer show the file. The earlier layer can still contain its bytes.

The same warning applies to ARG and ENV. Docker’s 2026 build documentation says build arguments and environment variables are unsuitable for secrets because their values can persist in the final image or associated metadata. BuildKit secret mounts and SSH mounts provide credentials temporarily during a build instead.

A multi-stage build narrows what reaches production. Docker’s 2026 guidance recommends keeping only runtime files in the final stage and supplying build credentials through temporary mounts rather than copying them into any stage that will be published. In my view, multi-stage builds are good hygiene, but they aren’t a magic eraser for a secret copied into the wrong published stage.

How can you prevent secrets from reaching Docker Hub?

Preventing Docker Hub leaked secrets requires controls before publication: keep credentials outside build contexts, use BuildKit secret mounts, inspect every image layer, and block credential-bearing commits or pushes. Docker Scout supports secret scanning with docker scout push --secrets in 2026, while GitHub and GitLab provide source-control push protection for supported secret types.

Your release process should contain the following checks, in this order:

  1. Exclude .env files, cloud credentials, private keys, local configuration, and development artifacts from the build context with a carefully reviewed .dockerignore.
  2. Replace credential-bearing ARG, ENV, and COPY instructions with BuildKit --mount=type=secret or --mount=type=ssh where appropriate.
  3. Use a multi-stage Dockerfile and verify that the published stage contains only runtime dependencies and application artifacts.
  4. Inspect layer history and extracted layer contents, not just the final container filesystem.
  5. Run image secret scanning before registry publication and enable GitHub or GitLab push protection before files enter the build context.
  6. Publish only after a clean result, then monitor cloud and API-provider logs for unexpected use.
See also  Ryzen 9 9950X3D2 review reveals 208MB cache for unmatched performance

Source-control checks and image checks solve different problems. GitHub or GitLab can stop a recognized key before commit or push, while image scanning can catch credentials introduced by build scripts, generated files, downloaded artifacts, or an unsafe Dockerfile. You need both gates.

Docker Scout’s command is useful, but no scanner recognizes every proprietary token or transformed credential. Teams handling cloud identities should pair scanning with short-lived credentials and tightly scoped permissions. A broader comparison of identity and access management platforms for smaller businesses can help when static keys have spread across deployment systems.

What should you do after publishing a secret?

After publishing Docker Hub leaked secrets, revoke or deactivate the credentials immediately, issue replacements, and investigate provider logs for unauthorized activity. AWS guidance in 2026 treats an exposed access key as compromised. Deleting the image or making the repository private does not invalidate copies already obtained by automated scanners.

Start with revocation, not cleanup. For an AWS access key, deactivate or delete the exposed key, create a replacement only where necessary, and inspect AWS activity for unfamiliar identities, regions, services, resources, or privilege changes. Apply the equivalent response at OpenAI, Anthropic, database, SSH, or other affected providers.

Next, preserve enough evidence to understand the incident: image digest, tag, publication time, registry visibility, build logs, Dockerfile, layer contents, and provider audit logs. Then remove the image and rebuild from a known-clean commit without the credential. Rotating first matters because deletion can’t pull a copied key back from thousands of unknown systems.

Do you need to respond if the image was public for only a few seconds? Yes. The 7.86-second result from 2026 makes any public interval long enough for plausible collection. Assuming compromise is less expensive than discovering later that a key funded API calls or opened a production account.

Access-key handling also belongs in staff training, incident drills, and deployment reviews. The skills behind those controls overlap with the security operations topics covered in these cybersecurity certifications for 2027.

How common are secrets in container images?

Secrets in container images are common enough to require routine prevention rather than exceptional cleanup. A 2023 internet-wide academic study examined 337,171 Docker Hub images and 8,076 private-registry images, finding secrets in 8.5% of images, including 52,107 private keys and 3,158 API secrets.

The 2023 study was broader than the 2026 honeypot experiment and answered a different question. The earlier work measured prevalence across public and private registry images; the later research measured how quickly planted credentials attracted abuse. Together, the results connect widespread exposure with rapid exploitation.

See also  Augmented and Virtual Reality: The Future of Immersive Experiences

There is also a platform-level counterargument: registries could scan before accepting public images. The 2026 researchers recommended pre-publication secret detection and restrictions or rate limits on Docker Hub’s feed of newly published or updated images. BleepingComputer reported that the team disclosed its findings to Docker in May 2026 and received an acknowledgment but no subsequent response; an August 2026 follow-up reportedly found no apparent defensive change.

Frequently asked questions

Can making a Docker Hub repository private secure an exposed key?

Making a Docker Hub repository private does not secure a credential that was previously public. The credential must be revoked or deactivated, replaced, and investigated because scanners may already possess a copy.

Are Docker build arguments safe for passwords and API keys?

Docker build arguments are not safe storage for passwords or API keys. Docker’s 2026 documentation says ARG and ENV values can persist in the final image; BuildKit secret mounts should be used for build-time credentials.

Does a multi-stage Docker build remove every secret?

A multi-stage Docker build limits what reaches the final stage, but it does not make a published stage safe if credentials were copied into that stage. Inspect the final image’s layers and use temporary secret mounts during the build.

Should you rotate a key if no unauthorized activity appears?

An exposed key should be rotated even when provider logs show no unauthorized activity. The 2026 Docker Hub study demonstrated that automated collection and first use can happen within seconds, while a copied credential may also be saved for later abuse.

EN