Thousands of secrets lurk in app images on Docker Hub


Thousands of secrets have been left exposed on Docker Hub, a platform where web developers collaborate on their code for web applications. While some are harmless API keys, others could lead to unauthorized access, data breaches, or identity theft, the latest Cybernews research reveals.

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.

ADVERTISEMENT

“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.

What were the web apps leaking?

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.

ADVERTISEMENT

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.

Docker hub images secrets

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.

ADVERTISEMENT

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.

Images with most secrets

What do you do if your secrets roam the wild?

The research demonstrates that the practice of leaving sensitive data in container images is widespread and often overlooked. Baubonis hopes the findings will serve as a wake-up call for organizations to fortify their security measures, such as robust data protection and encryption standards in digital media management and sharing.

Developers who find confidential information exposed within Docker Hub images should not wait for hackers to poke around trying to gain unauthorized access or private data.

“Reset already exposed secrets and make sure they weren’t used to access other sensitive data,” Baubonis said. “Encrypt sensitive data within images to prevent unauthorized access. Educate staff on the potential risks associated with embedded data in digital files.”

Formulating and enforcing stringent guidelines for secure digital content management and sharing would also help organizations mitigate the risks.

ADVERTISEMENT

“Apply comprehensive data sanitization protocols for Docker Hub images before publicly sharing them. Both developers and Docker Hub can utilize sophisticated detection tools for identifying and removing embedded secrets, which are available freely,” Baubonis noted.

The researchers scanned container images using 254 unique detectors, and three unique encodings were discovered (PLAIN, BASE64, UTF16). That shows that the secrets are very different in complexity and concealment.

It’s not only web applications that can contain secrets left by sloppy developers. Previous research by Cybernews also revealed that over half of the 30,000 investigated Android Apps are leaking secrets that could have huge repercussions for both app developers and their customers.