When Your Container Registry Becomes a Supply Chain Trojan: The Recent Harbor Vulnerabilities
cd ../blog
Vulnerability
Aug 10, 202615 min read

When Your Container Registry Becomes a Supply Chain Trojan: The Recent Harbor Vulnerabilities

S
Shubham Singla

Alright, folks, buckle up. We're talking about Harbor this week. For those of you living under a rock, or perhaps just not in the DevOps trenches, Harbor is that open-source container registry you've probably got humming along, diligently storing all your Docker images, Helm charts, and probably a few questionable meme containers from that one dev. It's the central nervous system for your containerized applications, a critical link in your software supply chain. When it coughs, your whole CI/CD pipeline catches a cold. And recently, Harbor had a nasty cough.

Harbor container registry under attack

The Unsettling News: Multiple Harbor Flaws

So, the news dropped recently about a series of vulnerabilities affecting Harbor, specifically versions 2.8.0 and earlier. We're talking about a cocktail of issues that, when combined, could really ruin your day. The big ones are CVE-2024-34079 and CVE-2024-34080, but there were a few others thrown in for good measure. Think of it like finding out the combination lock on your vault wasn't just old, but also had a sticky number *and* the hinges were loose. Not great for something holding your crown jewels.

The core problem here isn't just a single glaring bug. It's a collection of flaws that demonstrate a pattern: insufficient authorization checks and improper handling of certain API requests. This is the kind of stuff that keeps me up at night, because it’s not some esoteric kernel bug; it’s fundamental application logic that, when misconfigured or exploited, gives attackers a clear path to control your entire image repository. And if they control your image repository, they control what gets deployed into your production environments. That's a direct route to supply chain compromise, folks.

The Technical Breakdown: What Actually Happened

CVE-2024-34079: The Project Creation Bypass

Let's start with CVE-2024-34079. This one is a doozy. It's an improper authorization vulnerability that allows an authenticated user – even one with very limited privileges, say, a regular user who can only view public projects – to create new projects. Now, you might be thinking, "So what? They made a project." But here's the kicker: when you create a project in Harbor, you become its project administrator. This means you can then push images to it, scan them, and manage its members. Essentially, a low-privileged user can elevate their privileges to become a project admin simply by exploiting a flaw in how Harbor validates project creation requests.

The specific vector often involves manipulating API requests to the /api/v2.0/projects endpoint. An attacker doesn't even need any special headers or complex payloads beyond what a normal authenticated user would send. The application logic simply fails to properly check if the user has the global permission to create projects. It’s like a bouncer at a club letting anyone in who just says "I want to start a new VIP section" without checking if they're actually a VIP.

POST /api/v2.0/projects HTTP/1.1 Host: harbor.example.com Authorization: Bearer [low_priv_token] Content-Type: application/json { "project_name": "malicious-project", "public": false, "cve_whitelist": {"id": 1, "expires_at": -1} }

Once they've created their project and elevated themselves, they can then push malicious images, potentially containing backdoors or malware, and then attempt to trick other users or automated systems into pulling and deploying them. This is a classic supply chain attack vector, falling under MITRE ATT&CK technique T1589 (Drive-by Compromise) or T1588 (Obtain Capabilities), specifically through manipulating components.

CVE-2024-34080: The Image Push & Tag Manipulation

Then we have CVE-2024-34080, an improper authorization vulnerability concerning image pushing. This one allows a user with *read-only* access to a project to push images to that project. Let that sink in for a moment. Read-only. Like, you can look but not touch. Except, with this bug, you absolutely can touch. You can push new images and tags to projects you're not supposed to be able to modify. This is even more direct than the project creation bypass if the attacker already has read access to a project that's actively used.

The exploit here involves specially crafted API requests to the Docker Registry API that Harbor proxies. The authorization checks on the Harbor side fail to properly distinguish between read and write permissions for certain push operations. An attacker could use this to overwrite existing image tags with their malicious versions, or simply push new, dangerous images into a project. Imagine if someone with only viewing access to your GitHub repo could suddenly commit new code. That's the severity we're talking about.

Hacker in front of red servers
"Allowing a low-privileged user to become a project administrator or push malicious images to an existing project isn't just a bug; it's an open invitation for supply chain compromise. Your container registry is now a launchpad for their malware." - Shubham Singla

Other Flaws: Sensitive Data Exposure & Configuration Bypass

Beyond these two, there were other issues, including one that could lead to sensitive data exposure for webhook configurations and another allowing manipulation of project quotas. While perhaps not as flashy as direct RCE, these smaller vulnerabilities add up. They provide attackers with more information, more control, and more ways to evade detection or set up persistence. Think of them as the tiny cracks in the dam that, while not immediately catastrophic, weaken the whole structure.

Who is Affected?

If you're running Harbor, you're likely affected if you haven't patched. Specifically, versions Harbor 2.8.0 and earlier are vulnerable. This means a huge chunk of organizations leveraging containers, Kubernetes, and a robust CI/CD pipeline are potentially exposed. Any organization using Harbor as their internal or external container image registry needs to pay attention.

The risk is amplified if your Harbor instance is exposed to the internet or if you have a large number of internal users with varying privilege levels. The more users, the higher the chance that one low-privileged account could be compromised and used as a jumping-off point for these attacks.

Detection Guidance: What to Look For

Catching this kind of activity requires a keen eye on your Harbor logs and possibly your underlying Docker Registry logs. Here’s what I’d be looking for:

  1. Unexpected Project Creation: Monitor Harbor audit logs for new project creation events (project_create) by users who typically shouldn't have that permission. If a user with a 'developer' or 'guest' role is creating projects, that's a huge red flag. Look at the source IP, user agent, and the associated user ID.
  2. Unauthorized Image Pushes/Tag Overwrites: Scrutinize image push events (push_artifact) or tag manipulation events (create_tag, delete_tag) in projects where the user only has read access. This is a direct indicator of CVE-2024-34080 exploitation. The logs should clearly show the user attempting the action and their assigned permissions.
  3. Failed Authorization Attempts: While the exploit itself bypasses authorization, look for attempts that *fail* but indicate probing behavior. Repeated attempts to push to projects or create projects by a low-privileged user could signal reconnaissance before a successful exploit.
  4. Unusual Image Scans/Pulls: If an attacker successfully pushes a malicious image, they might then try to pull it from other systems or trigger scans. Monitor for scans or pulls of newly pushed images, especially if they appear to be from unexpected sources or by unexpected users.
  5. API Call Anomalies: Keep an eye on direct API calls to /api/v2.0/projects or Docker Registry API endpoints that seem out of place for specific user roles. Tools like an API gateway or WAF could help here if configured to log detailed request bodies and user tokens.
# Example Harbor audit log entry for suspicious project creation (simplified) {"level":"info","msg":"Project created","project_id":123,"project_name":"malicious-project","operator":"low_priv_user","op_time":"2024-07-25T10:00:00Z","client_ip":"192.168.1.10"} # Example for unauthorized image push {"level":"error","msg":"Unauthorized push attempt","repository":"my-prod-app/image-name","tag":"latest","operator":"read_only_user","op_time":"2024-07-25T10:05:00Z","client_ip":"192.168.1.11"}

Defense and Remediation Steps

This isn't rocket science, folks. Patching is paramount, but a good defense is multi-layered.

  1. Patch Immediately: The most critical step. Upgrade your Harbor instance to version 2.9.0 or later as soon as possible. These versions contain the fixes for the identified vulnerabilities. Seriously, drop everything and do this. If you can't upgrade immediately, consider temporary mitigation measures like restricting network access to Harbor.
  2. Strict Access Control: Review all user roles and permissions within Harbor. Implement the principle of least privilege rigorously. Does every user *really* need to create projects? Does every user *really* need write access to every project? Probably not. Remove unnecessary permissions.
  3. Network Segmentation: If your Harbor instance is internet-facing, put it behind a Web Application Firewall (WAF) and restrict access to known IP ranges where possible. Even if it's internal, segment your network to ensure only authorized systems (like your CI/CD runners) can access Harbor's push API.
  4. Regular Audits: Periodically audit your Harbor projects, users, and roles. Look for unexpected projects, users with elevated privileges they shouldn't have, or images pushed from unknown sources. Integrate these audits into your security operations routine.
  5. Container Image Signing and Verification: Implement image signing (e.g., Notary, Cosign) and enforce signature verification in your CI/CD pipeline and Kubernetes admission controllers. Even if a malicious image gets pushed, it won't be deployed if it's not properly signed by an authorized key. This is a critical last line of defense against supply chain attacks.
  6. Registry-side Scanning: Ensure your Harbor instance has robust vulnerability scanning enabled for all pushed images. While not directly preventing the exploit, it helps catch malicious payloads once they're inside your registry.

Ignoring these vulnerabilities is like leaving the front door to your house wide open, with a sign that says 'Valuables Inside'. Harbor is a critical component of your container ecosystem. Treat it with the respect (and security) it deserves.

Q&A

What is Harbor and why is it critical to secure?

Harbor is an open-source cloud native registry that stores, signs, and scans container images and Helm charts. It's critical because it acts as the central repository for all containerized applications, making it a key component in the software supply chain. A compromise here can lead to malicious code being injected into production systems.

How do these specific Harbor vulnerabilities (CVE-2024-34079, CVE-2024-34080) facilitate supply chain attacks?

CVE-2024-34079 allows low-privileged users to create new projects and become project administrators, giving them full control over that project. CVE-2024-34080 allows read-only users to push images to existing projects. Both enable attackers to inject malicious or backdoored container images into the registry, which can then be pulled and deployed into production, thus compromising the software supply chain.

What are the immediate detection steps for an organization suspecting a Harbor compromise?

Immediately check Harbor audit logs for unexpected project creation events by low-privileged users, unauthorized image pushes or tag manipulations in projects, and any unusual API activity. Correlate these with user roles and expected behavior. Look for specific log entries indicating project creation or image push from users with insufficient permissions.

Beyond patching, what are the most impactful long-term defensive strategies against such vulnerabilities in container registries?

Beyond patching, implementing strict least-privilege access controls, strong network segmentation, and regular security audits of user roles and project permissions are vital. Furthermore, enforcing image signing and signature verification within the CI/CD pipeline and Kubernetes admission controllers provides a critical defense layer, ensuring only trusted images are deployed.

How does this incident relate to broader supply chain security concerns?

This incident highlights the pervasive risk in the software supply chain, where a single compromised component (like a container registry) can become a vector for widespread system compromise. It underscores the need for continuous vigilance, not just at the code development stage, but across all stages of software artifact management and deployment.

Actionable Takeaways: Patch your Harbor instances to 2.9.0 or newer. Immediately. Review every single user's permissions in Harbor – if they don't absolutely need write access, revoke it. Implement image signing and enforce verification in your build and deployment pipelines. Your registry isn't just storage; it's a gatekeeper. Make sure it's doing its job.