If you're using Harbor as your container registry, bear in mind it can be hijacked with has_admin_role = True
Patch now before miscreants sail off with your apps, data
Video IT departments using the Harbor container registry will want to update the software ASAP, following Thursday's disclosure of a bug that can be exploited by users to gain administrator privileges.
Aviv Sasson, of Palo Alto Networks' Unit 42 security team, found that under its default settings, Harbor accepts an API call that can, inadvertently, elevate a normal user's permissions. If you can reach a vulnerable Harbor installation's web interface, you can potentially pwn it.
Seeing as Harbor is used by enterprises and cloud platforms to manage collections of Docker and Kubernetes containers, which themselves contain applications and other resources, gaining administrative access is a big deal: a rogue admin can swipe data from the registry, or tamper with containers to inject malware into services.
"The attacker can download all of the private projects and inspect them. They can delete all of the images in the registry or, even worse, poison the registry by replacing its images with their own," Sasson explained. "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."
The flaw itself is in the code behind the registry's HTTP POST-based API. Sasson discovered that a miscreant can request the creation of a new account and enable an admin for this user all at the same time. This registration request is not properly screened, and the admin account creation is approved. It is as simple as setting a flag,
has_admin_role, in the request to
"The problem," said Sasson, "is that we can send a request and add the parameter...
"has_admin_role" = “True”
...the user that will be created will be an admin. It’s as simple as that."
Here's a video demonstrating exploitation of this programming blunder:
Admins can edit the default settings to prevent this from happening, though Sasson reckons that most are unaware of that. Of a scan of 2,500 online public-facing Harbor instances, 1,300 were found to be vulnerable.
The vulnerability is designated CVE-2019-16097. Sasson and Unit 42 opted not to brand it with a cute nickname. Good on them.
The bug was found in Harbor versions 1.7.0, 1.8.2, and prior. Sysadmins can close the vulnerability by updating to versions 1.7.6, 1.8.3 and later. ®