API keys leaked on Docker Hub get stolen within seconds, study finds

Biểu đồ thời gian gọi API sau khi image chứa khóa lộ lên Docker Hub

A test with 300 decoy images shows an AWS key was used just 7.86 seconds after upload, so if an API key slips onto Docker Hub, there is almost no time to save it.

⚡ MIGOVI TL;DR

  • A Stony Brook University team posted 300 decoy images to 8 public container registries over 4 months
  • The fastest AWS key was used after 7.86 seconds, the median was 51.19 seconds, and all 100 keys were used within 15 minutes
  • OpenAI and Anthropic keys were hijacked to drain the balances of the test accounts
  • Scanning tools mostly read image layers directly and rarely run the container
  • The researchers reported the issue to Docker in May but have received no concrete response

A test measuring how fast leaked keys are exploited

Researchers Billy Tsouvalas and Nick Nikiforakis of Stony Brook University wanted to know how quickly credentials accidentally left in a public image get discovered. They posted a total of 300 decoy images to 8 public container registries, including Docker Hub. Over 4 months, they planted API keys for AWS, OpenAI, and Anthropic, along with fake SSH and database credentials. Detection tooling alerted the team whenever an image was built, run, or opened in a shell, which let them trace each step a stranger took toward the keys.

The results were presented yesterday at the ACM Conference on Computer and Communications Security (CCS). The decoy images were pulled more than 75,000 times, and the AWS keys alone received more than 140,000 API calls from 5,000 different IP addresses. Activity on AWS varied: some actors only checked whether a key still worked, others enumerated available resources, and sometimes attackers took the final step and used those resources.

Chart showing the timing of API calls after an image containing leaked keys was posted to Docker Hub
Time until API calls appeared after the image was posted

The speed is the most worrying part. The fastest AWS key was used 7.86 seconds after the image went up on Docker Hub, the median time to the first call was 51.19 seconds, and all 100 AWS keys were used within 15 minutes. OpenAI and Anthropic keys were also seized very quickly to burn through the balances of the test accounts. Nearly all AWS activity came from Docker Hub, while Harbor, another registry in the experiment, also recorded some cases of AWS key abuse.

How the scanning tools work

The team calls these automated scanners "ContainerBots," but that is just a convenient label, since there is no sign the scans are run by a single group. Monitoring rarely recorded anyone actually running the decoy images, so the authors conclude that most tools harvest credentials by reading image layers directly. According to them, these scanners almost always rely on static analysis, such as unpacking layers or calling registry APIs to retrieve filesystem contents, without launching the container.

This means a publicly available image is enough to have its keys taken, even if nobody ever runs it. Secrets are already being exposed this way in the wild, and revoking leaked keys takes a lot of effort and coordination among multiple parties. With a window measured in seconds, deleting the image after an incident is usually too late.

Recommendations and Docker's response

The researchers urge Docker Hub to scan images for secrets before allowing them to be published, and to warn uploaders when embedded keys appear to be present. They also suggest restricting or rate-limiting access to the public feed that lists newly posted or updated images, to hinder mass scanning tools.

According to Tsouvalas, the team reported the findings and the full paper to Docker in May, but apart from an acknowledgment of receipt, they got no further response. A small-scale test in August, checking whether the platform had introduced any defenses, also showed no change.

MIGOVI VIEWPOINT

For Migovi, the 7.86-second figure shows that "detect, then delete" is nearly meaningless for a key that has already been pushed to a public registry, because by the time you notice, the key is already in someone else's hands. The safe approach is to act before publishing: scan images for secrets with automated tools, and put keys in environment variables or a secrets manager instead of hardcoding them in files. If you suspect you have posted an AWS, OpenAI, or Anthropic key somewhere, revoke it and issue a new one immediately rather than just removing the image, and set a spending limit to reduce the damage. Docker's lack of any move after several months is also a reason for development teams in Vietnam to protect themselves rather than wait on the platform.

Source: BleepingComputer

Reviewed by: Hero Association

Share your thoughts ^^

Your email address will not be published. Required fields are marked *

Insights

Contents

  1. A test measuring how fast leaked keys are exploited
  2. How the scanning tools work
  3. Recommendations and Docker's response