Three million Docker Hub repositories are being used to spread malware

Red warning symbol on a background of 0s and 1s
(Image credit: Getty Images)

Three million Docker Hub repositories have been impacted by a series of large-scale malware campaigns that saw millions of malicious files planted since 2021, according to new research. 

Docker Hub is a cloud-based repository service used for finding and sharing containers, and currently hosts over 15 million repositories. 

According to researchers at JFrog, around 20% of Docker Hub’s public repositories actually hosted malicious content. This varied from rudimentary spam messages promoting pirated content,  to more sophisticated malware and phishing assets, all of which were uploaded using automatically generated accounts.

These campaigns were made possible by a documentation feature introduced by Docker to help users find the right container for their needs.

Docker Hub introduced a number of community features to enhance its usability and allow it to function as a community platform for public repositories. 

To help users search for images Docker Hub allowed repository maintainers to add short descriptions and documentation to their repositories in HTML format, which is then displayed on the repository’s main page.

The idea was to provide a brief explanation of the purpose of the image but hackers found a way to exploit this functionality to upload malicious content to the repository instead.

JFrog found that around 4.6 million repositories hosted on Docker Hub were imageless, meaning they had no content bar the repository documentation; this represents 30% of all public repositories hosted on the platform.

Without a container image these repositories are unusable, indicating there was an ulterior motive behind these imageless repos.

Further investigation revealed that the majority of these imageless repositories - approximately 2.81 million - were uploaded with malicious content, and JFrog said it was able to link all of these repos to three large-scale malware campaigns.

Thousands of fake Docker Hub repositories created every day

JFrog pulled every imageless Docker Hub repository published in the previous five years and was able to identify patterns according to when they were uploaded, the frequency of the upload, and the content of the repository documentation. 

This enabled the researchers to create signatures for particular types of fake repository and apply the signature to the imageless repos in order to group them by campaign.

Two of the campaigns, ‘Downloader’ and ‘eBook phishing’ were particularly active in the first half of 2021, publishing thousands of repositories every day. 

The eBook phishing campaign consists of nearly a million repositories created in the middle of 2021 that all offer free eBook downloads containing randomly generated descriptions and download links.

These links eventually redirect to the same page where users are promised a free copy of the eBook and prompted to complete a form that logs the user’s credit card information and charges the victim a monthly subscription of around $50.

The Downloader campaign refers to a set of repositories that contain automatically generated texts with SEO text proposing to download pirated content with video game cheat codes. 

Notably this campaign operated in two distinct rounds, although both used an identical malicious payload, with the first round taking place in 2021 alongside the eBook campaign, and then resurfacing in 2023.

The 2021 stage involved malicious domains disguising themselves as shortened links, but instead of actually encoding the URL they encode a file name and resolve a link to a different domain whenever a malicious resource is shut down.

JFrog asserted the purpose of this system is to serve as a proxy for a malicious content delivery network (CDN), and provided a list of all the malicious domains and fraudulent shorteners used in the campaign.

The second instance of the Downloader campaign came in 2023 and this time focused on avoiding detection. The imageless repositories no longer used direct links to malicious sources but instead pointed to legitimate resources as redirects to malicious ones.

Website SEO – a suspiciously toothless malware campaign

The third campaign differed from the first two in terms of its upload frequency, instead uploading a small number of repositories every day for three years, and limited the number of repositories per user to just one.

JFrog noted that this campaign was perplexing in that the content of the repositories was not overtly malicious. 

Although the imageless containers were clearly uploaded for nefarious purposes as they could not be used by developers, the content was mostly harmless, often just a random description string of letters.

RELATED WHITEPAPER

Notably, every repo published by these users was given the same name ‘website’. Jfrog suggested that this campaign was used as a ‘stress test’ to gauge the efficacy of the attack vector before embarking on the truly malicious campaigns.

JFrog disclosed its findings to the Docker security team, including the  3.2 million repositories it suspected were hosting malicious content, which were all subsequently removed.

The indicators of compromise (IoC) for the payload used in the Downloader and eBook phishing campaigns are also available in the JFrog report.

Solomon Klappholz
Staff Writer

Solomon Klappholz is a Staff Writer at ITPro. He has experience writing about the technologies that facilitate industrial manufacturing which led to him developing a particular interest in IT regulation, industrial infrastructure applications, and machine learning.