Harbor registries with default settings are impacted by a vulnerability that allows any user to elevate privileges to administrator, Palo Alto Networks reports.
An open-source cloud native registry that integrates with Docker Hub, Docker Registry, Google Container Registry, and others, Harbor stores, signs and scans container images for vulnerabilities. Users are provided with a simple GUI to download, upload, and scan images.
Tracked as CVE-2019-16097, the vulnerability could allow an attacker to take over Harbor registries via malicious requests. Palo Alto Networks’ security researchers discovered around 1,300 registries that are open to the Internet and which also have default settings, meaning they are at risk.
An attacker exploiting this vulnerability could download private projects and inspect them, delete images in the registry, or even poison the registry by replacing its images with their own.
“The attacker can create a new user and set it to be admin. After that, they can connect to Harbor registry via the Docker command line tool with the new credentials and replace the current images with anything they desire. These can include malware, crypto miners or even worse,” the researchers explain.
The issue, Palo Alto Networks says, resides in one of the available API calls. A user can send a POST request to access the code in charge with the registration of new users. If the request also includes the parameter HasAdminRole set to “True,” which indicates that the user is an admin, then the created user is an admin.
“I wrote a simple Python script that sends a post request to /api/users in order to create a new user with admin privileges, by setting the ‘has_admin_role’ parameter in the request body to True. After running this script, all we need to do is to open Harbor in the browser and just sign in to the user we created,” Palo Alto Networks’ Aviv Sasson explains.
The researcher responsibly disclosed the vulnerability to Harbor, which has already released patches to address it. Harbor versions 1.7.6 and 1.8.3 include the fix, which prevents non-users from creating a new admin user.
Affected versions are 1.7.0 – 1.8.2 and all users are advised to update their Harbor installations to prevent others from gaining full access to their registry.
Related: Public Exposure of Sensitive Files on the Internet is Getting Worse
Related: Nexus Repository Flaws Expose Thousands of Private Artifacts