Pierluigi Paganini November 29, 2023
The Docker Hub store has at least 5,493 container images that contain secrets and could be considered as exposing sensitive information. That makes up 54% of the 10,178 Docker Hub images the Cybernews Research team analyzed.
The analyzed leaky containers were downloaded over 132 billion times by other users on the widely used platform.
“That means that exposed secrets could be running on multiple servers around the globe, posing risks and draining cloud resources from inconspicuous Docker Hub contributors. Leaving any secrets exposed while uploading your images online poses a high risk of threat actors finding them,” Cybernews researcher Vincentas Baubonis warns.
Web developers love to use Docker Hub for developing, shipping, and running applications known as containers. Containers are pieces of software that keep websites and services running reliably, forming a larger structure like Lego sets.
One container could be responsible for hosting a website you visit, another container might manage the database, and others could run the backend for other apps. They perform process-wise isolated functions, and if one part of the system fails, Docker helps admins fix the isolated part only while others keep working. But it’s easy to lose track of many containers and data flows, sometimes leading to mistakes and exposing secrets.
Docker Hub is a cloud-based repository for container images, offering both public and private storage and collaboration solutions. Docker Hub is a subsidiary service of Docker, a major player in the digital container industry. Headquartered in San Francisco, the company significantly contributes to this transformative software development and deployment shift.
The secrets left by developers in their containers are not all created equal, but good practice is always to keep them hidden.
Cybernews Researchers pulled a staggering number of 191,529 secrets by scraping and analyzing 5,493 publicly shared container images. Removing the duplicates would decrease the number of unique secrets to 48,481.
The exposed secrets included API or SSH keys, access control tokens, internal use URLs, and even private credentials.
The secrets correlated well with the most popular web services used by developers.
GitHub tokens were the most disregarded, as the number of such secrets comprised 26.6% of total secrets, or 51,038.
“GitHub tokens are used for authentication and authorization when interacting with the GitHub API – they come with specific permissions. If not managed correctly, GitHub token in the hands of malicious actors could lead to viewing, modifying, and even deleting repositories containing source code and other sensitive information,” Baubonis said.
The second most unattended secret (13.9%) is Datadog Tokens, mostly used for authenticating and accessing the Datadog monitoring and analytics platform. Hackers could use those to view analytic information, manipulate the data, misuse resources, or disrupt the service.
The next most exposed secret (7.6%) was Uniform Resource Identifiers, which include resource locations, such as web addresses or file paths. Exposed private file paths could lead to unauthorized access, data manipulation, and API abuse, and also could be used for brute force or other types of attacks and espionage.
Researchers also found 10,000 private keys used for encryption or decryption and a similar number of LDAP (Lightweight Directory Access Protocol used for managing and accessing directories) secrets.
However, those secrets which came in lesser numbers were the most dangerous.
Cybernews Researchers obtained 9196 PayPal OAuth secrets, which are used to control access to user accounts and financial information. Also, 7919 UnifyID secrets could expose identity-related data.
Scraped secrets included thousands of DigitalOcean (cloud infrastructure resources), Cloudflare API, SQLServer (database management), FTP, and other credentials, tokens, and similar secrets.
Most secrets come from re-using packages with sensitive information exposed within them. Also, some container images contain hard-coded secrets by the design of containerized apps and do not expose any sensitive information. However, the significance of the findings should not be underestimated.
“Developers expose diverse hidden data types and a vast amount of sensitive data. The ratio of unique secrets per each vulnerable docker image is practically eight to one, meaning that one image, exposing any secrets, is likely exposing eight of them on average,” Baubonis warned.
An individual investigation into each image and its secrets is required to define whether the practice is secure. However, Baubonis is certain that many of the exposed secrets aren’t supposed to be there, posing significant security risks.
“Even if the credentials, tokens, and other secrets are no longer valid, leaving them public is still a bad practice. Even old references to sensitive data show a sloppy security posture,” Baubonis said.
https://cybernews.com/security/docker-hub-images-contain-thousands-of-secrets/
About the author: Ernestas Naprys, Senior Journalist at CyberNews
Follow me on Twitter: @securityaffairs and Facebook and Mastodon
(SecurityAffairs – hacking, Docker Hub)