Research from Stony Brook University has revealed that credentials and secrets exposed in public Docker Hub images are being extracted and exploited by attackers in as little as eight seconds after being published. Researchers Billy Tsouvalas and Nick Nikiforakis conducted an experiment involving 300 honeypot images across eight public container registries, including Docker Hub. Over four months, they exposed various API keys and credentials, monitoring their use and setting up detection tools to track image interactions.
The study found that AWS keys embedded in these images were particularly targeted, with over 140,000 API calls from 5,000 unique IP addresses. The fastest observed usage of an AWS key was just 7.86 seconds after the image's publication, with all keys being utilized within 15 minutes. Most of this activity occurred on Docker Hub, although some abuse was also noted on other registries like Harbor.
The researchers identified automated scanners, termed 'ContainerBots,' that extracted credentials without instantiating the containers. These bots typically performed static analysis, accessing the images' filesystem contents directly. The quick and widespread exploitation of these credentials highlights the significant challenge of revoking leaked keys and the need for robust preventive measures.
Tsouvalas and Nikiforakis recommend that Docker Hub implement secret-scanning measures before images go live to alert publishers of potential risks. They also suggest restricting access to Docker Hub's public feed to limit the effectiveness of mass-scanning tools. Despite reporting these issues to Docker in May and conducting a follow-up experiment in August, no defensive measures have been observed on the platform.

