Improper Scope Enforcement in OAuth client_credentials Flow Allows Read-Only API Key to Escalate to Full Access
CVE-2026-21621Published 5 Mar 2026, 19:20 UTC
Real-world risk
1.6/ 10Low
Routine
If the vulnerable configuration applies to you: 3.6
PreliminaryFrom the CVSS vector only · confidence low
CVSS
7.0
scored by the vendor (CNA), CVSS 4.0
In plain words
No plain-language summary yet. The original description is below.
Original description (from EEF)
Incorrect Authorization vulnerability in hexpm hexpm/hexpm (HexpmWeb.API.OAuthController module) allows Privilege Escalation. An API key created with read-only permissions (domain: "api", resource: "read") can be escalated to full write access under specific conditions. When exchanging a read-only API key via the OAuth client_credentials grant, the resource qualifier is ignored. The resulting JWT receives the broad "api" scope instead of the expected "api:read" scope. This token is therefore treated as having full API access. If an attacker is able to obtain a victim's read-only API key and a valid 2FA (TOTP) code for the victim account, they can use the incorrectly scoped JWT to create a new full-access API key with unrestricted API permissions that does not expire by default and can perform write operations such as publishing, retiring, or modifying packages. This vulnerability is associated with program files lib/hexpm_web/controllers/api/oauth_controller.ex and program routines HexpmWeb.API.OAuthController.validate_scopes_against_key/2. This issue affects hex.pm: from 2025-08-18 before 2026-03-05; hexpm/hexpm: from 71829cb6f6559bcceb1ef4e43a2fb8cdd3af654b before 71c127afebb7ed7cc637eb231b98feb802d62999.
Am I affected?
| Product | Affected versions (from the sources) | Fixed in |
|---|---|---|
| hexpmNiche | >= 2025-08-18, < 2026-03-05 | 2026-03-05 |
What to do
Update to a fixed version: 2026-03-05.
Why this score
| Factor | Value | Evidence | × |
|---|---|---|---|
| Impact | Major data tamperingWrites or changes important data without gaining execution | From the CVSS vector | 0.70 |
| Attacker position | InternetAnyone on the Internet can reach a typical deployment | From the CVSS vector | 1.00 |
| Privileges needed | LowA real low-privileged account | From the CVSS vector | 0.60 |
| Victim interaction | NoneNothing | From the CVSS vector | 1.00 |
| Configuration | UncommonNeeds a non-default feature that a minority enables | From the CVSS vector | 0.45 |
| Reliability | ReliableDeterministic: injection, logic bug, path traversal | From the CVSS vector | 1.00 |
Threat level T1: Nothing known (× 0.85)
The default for a new disclosure
EPSS 0.4% chance of exploitation in 30 days (percentile 36), as of 2026-12-03.
The arithmetic
- Prerequisites multiplied together0.270
- Threat T1: Nothing known0.850
- 10 × impact 0.7 × prerequisites 0.27 × threat 0.851.607
- Rounded to one decimal between 0.1 and 101.6
Exploitation and evidence timeline
- 5 Mar 2026 Published
- 3 Dec 2026 Risk 1.6 (cvss fallback)
Weakness
CWE-863
References
- https://github.com/hexpm/hexpm/security/advisories/GHSA-739m-8727-j6w3related, vendor-advisory
- https://cna.erlef.org/cves/CVE-2026-21621.htmlrelated
- https://osv.dev/vulnerability/EEF-CVE-2026-21621related
- https://github.com/hexpm/hexpm/commit/71829cb6f6559bcceb1ef4e43a2fb8cdd3af654brelated
- https://github.com/hexpm/hexpm/commit/71c127afebb7ed7cc637eb231b98feb802d62999patch
- CVE-2026-21621 on CVE.org