Distribution Registry Token Authentication Vulnerability Allowing JWK Injection in JWTs

Vulnerability

A vulnerability exists in the Distribution registry, specifically in versions 3.0.0-beta.1 prior to 3.0.0-rc.2, when token authentication is enabled. The issue arises from the JSON Web Key (JWK) verification process, which allows an attacker to inject an untrusted signing key into a JSON Web Token (JWT). The vulnerability occurs because the verification code only checks if the Key ID (kid) matches a trusted key, without validating the actual key material. This flaw can be exploited by creating a JWT with a JWK header that includes a public key, bypassing the intended security measures.

Impact

Exploitation of this vulnerability allows for the injection of untrusted signing keys into JWTs, potentially leading to unauthorized actions or access within the application.

Reproduction

To reproduce this vulnerability, first generate a key pair and create a JWT. Include the public key in the JWK header and set the Key ID to match one of the trusted keys. Sign the JWT with the private key and then the registry will accept the JWT, verifying the signature with the injected public key, due to the flawed verification process.

Remediation

Users should update to Distribution registry version 3.0.0-rc.3 or later. If the system requires token authentication, there is no workaround available without applying the patch.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
5.0
exploitability
8.4
remediation
7.7
relevance
0.0
threat
4.8
urgency
2.9
incentive
5.8

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.