{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-21621","assignerOrgId":"6b3ad84c-e1a6-4bf7-a703-f496b71e49db","state":"PUBLISHED","assignerShortName":"EEF","dateReserved":"2026-01-01T03:46:45.934Z","datePublished":"2026-03-05T19:20:05.831Z","dateUpdated":"2026-04-06T16:44:09.535Z"},"containers":{"cna":{"affected":[{"collectionURL":"https://github.com","cpes":["cpe:2.3:a:hexpm:hexpm:*:*:*:*:*:*:*:*"],"defaultStatus":"unaffected","modules":["'Elixir.HexpmWeb.API.OAuthController'"],"packageName":"hexpm/hexpm","packageURL":"pkg:github/hexpm/hexpm","product":"hexpm","programFiles":["lib/hexpm_web/controllers/api/oauth_controller.ex"],"programRoutines":[{"name":"'Elixir.HexpmWeb.API.OAuthController':validate_scopes_against_key/2"}],"repo":"https://github.com/hexpm/hexpm.git","vendor":"hexpm","versions":[{"lessThan":"71c127afebb7ed7cc637eb231b98feb802d62999","status":"affected","version":"71829cb6f6559bcceb1ef4e43a2fb8cdd3af654b","versionType":"git"}]},{"defaultStatus":"unaffected","product":"hex.pm","vendor":"hexpm","versions":[{"lessThan":"2026-03-05","status":"affected","version":"2025-08-18","versionType":"date"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:a:hexpm:hexpm:*:*:*:*:*:*:*:*","versionEndExcluding":"71c127afebb7ed7cc637eb231b98feb802d62999","versionStartIncluding":"71829cb6f6559bcceb1ef4e43a2fb8cdd3af654b","vulnerable":true}],"negate":false,"operator":"AND"}],"operator":"AND"}],"credits":[{"lang":"en","type":"finder","value":"Michael Lubas / Paraxial.io"},{"lang":"en","type":"remediation developer","value":"Jonatan Männchen / EEF"}],"descriptions":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"Incorrect Authorization vulnerability in hexpm hexpm/hexpm ('Elixir.HexpmWeb.API.OAuthController' module) allows Privilege Escalation.<p>An API key created with read-only permissions (domain: \"api\", resource: \"read\") can be escalated to full write access under specific conditions.</p><p>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.</p><p>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.</p><p>This vulnerability is associated with program files <tt>lib/hexpm_web/controllers/api/oauth_controller.ex</tt> and program routines <tt>'Elixir.HexpmWeb.API.OAuthController':validate_scopes_against_key/2</tt>.</p><p>This issue affects hexpm: from 71829cb6f6559bcceb1ef4e43a2fb8cdd3af654b before 71c127afebb7ed7cc637eb231b98feb802d62999.</p>"}],"value":"Incorrect Authorization vulnerability in hexpm hexpm/hexpm ('Elixir.HexpmWeb.API.OAuthController' module) allows Privilege Escalation.\n\nAn API key created with read-only permissions (domain: \"api\", resource: \"read\") can be escalated to full write access under specific conditions.\n\nWhen 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.\n\nIf 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.\n\nThis vulnerability is associated with program files lib/hexpm_web/controllers/api/oauth_controller.ex and program routines 'Elixir.HexpmWeb.API.OAuthController':validate_scopes_against_key/2.\n\nThis issue affects hexpm: from 71829cb6f6559bcceb1ef4e43a2fb8cdd3af654b before 71c127afebb7ed7cc637eb231b98feb802d62999."}],"impacts":[{"capecId":"CAPEC-233","descriptions":[{"lang":"en","value":"CAPEC-233 Privilege Escalation"}]}],"metrics":[{"cvssV4_0":{"Automatable":"NOT_DEFINED","Recovery":"NOT_DEFINED","Safety":"NOT_DEFINED","attackComplexity":"LOW","attackRequirements":"PRESENT","attackVector":"NETWORK","baseScore":7,"baseSeverity":"HIGH","exploitMaturity":"NOT_DEFINED","privilegesRequired":"LOW","providerUrgency":"NOT_DEFINED","subAvailabilityImpact":"NONE","subConfidentialityImpact":"NONE","subIntegrityImpact":"HIGH","userInteraction":"NONE","valueDensity":"NOT_DEFINED","vectorString":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:H/SA:N","version":"4.0","vulnAvailabilityImpact":"LOW","vulnConfidentialityImpact":"NONE","vulnIntegrityImpact":"HIGH","vulnerabilityResponseEffort":"NOT_DEFINED"},"format":"CVSS","scenarios":[{"lang":"en","value":"GENERAL"}]}],"problemTypes":[{"descriptions":[{"cweId":"CWE-863","description":"CWE-863 Incorrect Authorization","lang":"en","type":"CWE"}]}],"providerMetadata":{"orgId":"6b3ad84c-e1a6-4bf7-a703-f496b71e49db","shortName":"EEF","dateUpdated":"2026-04-06T16:44:09.535Z"},"references":[{"tags":["vendor-advisory","related"],"url":"https://github.com/hexpm/hexpm/security/advisories/GHSA-739m-8727-j6w3"},{"tags":["related"],"url":"https://cna.erlef.org/cves/CVE-2026-21621.html"},{"tags":["related"],"url":"https://osv.dev/vulnerability/EEF-CVE-2026-21621"},{"tags":["patch"],"url":"https://github.com/hexpm/hexpm/commit/71c127afebb7ed7cc637eb231b98feb802d62999"}],"source":{"discovery":"INTERNAL"},"title":"Improper Scope Enforcement in OAuth client_credentials Flow Allows Read-Only API Key to Escalate to Full Access","workarounds":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<ul><li>Revoke and reissue exposed API keys immediately if compromise is suspected.</li><li>Avoid relying on read-only API keys as a strict security boundary in high-risk environments.</li><li>Closely monitor audit logs for unexpected API key creation events.</li><li>Enforce strong 2FA hygiene and protect TOTP seeds carefully.</li></ul><p>There is no complete mitigation without upgrading, as the issue exists in server-side scope validation logic.</p>"}],"value":"* Revoke and reissue exposed API keys immediately if compromise is suspected.\n* Avoid relying on read-only API keys as a strict security boundary in high-risk environments.\n* Closely monitor audit logs for unexpected API key creation events.\n* Enforce strong 2FA hygiene and protect TOTP seeds carefully.\n\nThere is no complete mitigation without upgrading, as the issue exists in server-side scope validation logic."}],"x_generator":{"engine":"Vulnogram 0.2.0"}},"adp":[{"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-03-06T18:03:45.435445Z","id":"CVE-2026-21621","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2026-03-06T18:03:52.971Z"}}]}}