Distribution's token authentication allows to inject an untrusted signing key in a JWT

Description

Impact

Systems running registry version > 3.0.0-beta.1 with token authentication enabled.

Patches

Update to at least v3.0.0-rc.3

Workarounds

There is no way to work around this issue without patching if your system requires token authentication.

References

The issue lies in how the JWK verification is performed. When a JWT contains a JWK header without a certificate chain, the code only checks if the KeyID (kid) matches one of the trusted keys, but doesn't verify that the actual key material matches.

Here's the problematic flow:

  1. An attacker generates their own key pair
  2. They create a JWT and include their public key in the JWK header
  3. They set the kid in the JWK to match one of the trusted keys' IDs (which they could potentially discover)
  4. They sign the JWT with their private key
  5. The registry only checks if the kid exists in the trusted keys map but then uses the attacker's public key from the JWK to verify the signature

Basic information

Type
reviewed
Severity
high
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2025-02-11 17:57:58 UTC
Updated
2026-01-23 17:04:31 UTC
GitHub reviewed
2025-02-11 17:57:58 UTC
NVD published
2025-02-11

EPSS Score

Score Percentile
0.11% 30.20%

CVSS Scores

Base score Version Severity Vector
8.7 4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network.
Attack complexity (AC:L)
Exploitation conditions are straightforward and stable.
Attack requirements (AT:N)
No additional preconditions are required beyond normal reachability.
Privileges required (PR:N)
No privileges are required.
User interaction (UI:N)
No user interaction is required.
Vulnerable system confidentiality impact (VC:N)
No confidentiality impact on the vulnerable system.
Vulnerable system integrity impact (VI:H)
High integrity impact on the vulnerable system.
Vulnerable system availability impact (VA:N)
No availability impact on the vulnerable system.
Subsequent system confidentiality impact (SC:N)
No confidentiality impact on subsequent systems.
Subsequent system integrity impact (SI:N)
No integrity impact on subsequent systems.
Subsequent system availability impact (SA:N)
No availability impact on subsequent systems.

Identifiers

CWEs

CWE id Name
CWE-639 Authorization Bypass Through User-Controlled Key

Credits

  • evanebb (reporter)

Affected packages (1)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
go github.com/distribution/distribution/v3 > 3.0.0-beta.1, < 3.0.0-rc.3 3.0.0-rc.3

References

cvelogic Threat Intelligence