Am I affected?

type your hexpm/hexpm version to check

Description

Insufficient Session Expiration vulnerability in the OAuth token refresh grant in hexpm hexpm allows a user removed from an organization to keep reading its private packages.

expand_repositories_scope/3 in lib/hexpm/permissions.ex only rewrites the literal repositories scope, so an explicitly granted repository:<org> or docs:<org> scope passes through it untouched. The refresh grant re-derives a new token from the stored granted_scopes, which holds that expanded form, so every refresh reproduces the organization scope without revisiting membership. Because both CDN edges authorize repository access from the token claim without querying the database, an account removed from an organization retains read access for as long as it keeps refreshing, bounded by the 30 day refresh token lifetime rather than the 30 minute access token lifetime.

This issue affects hex.pm: from 2025-10-10 before 2026-08-24.

Weaknesses & attack patterns

Weakness

CWE-613 · Insufficient Session Expiration in catalog → MITRE ↗

Attack patterns

CAPEC-122 · Privilege Abuse MITRE ↗

Affected — hexpm / hexpm

2025-10-10 < 2026-08-24 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:hexpm:hexpm:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Hexpm.Permissions' · 'Elixir.Hexpm.OAuth.Tokens' · 'Elixir.HexpmWeb.API.OAuthController'
source files lib/hexpm/permissions.ex · lib/hexpm/oauth/tokens.ex · lib/hexpm_web/controllers/api/oauth_controller.ex
routines 'Elixir.Hexpm.Permissions':expand_repositories_scope/2 · 'Elixir.Hexpm.OAuth.Tokens':create_for_user/6 · 'Elixir.HexpmWeb.API.OAuthController':handle_refresh_token_grant/2

Affected — GitHub / hexpm/hexpm Repository ↗

650faa0 < 50cffd2 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:hexpm:hexpm:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Hexpm.Permissions' · 'Elixir.Hexpm.OAuth.Tokens' · 'Elixir.HexpmWeb.API.OAuthController'
source files lib/hexpm/permissions.ex · lib/hexpm/oauth/tokens.ex · lib/hexpm_web/controllers/api/oauth_controller.ex
routines 'Elixir.Hexpm.Permissions':expand_repositories_scope/2 · 'Elixir.Hexpm.OAuth.Tokens':create_for_user/6 · 'Elixir.HexpmWeb.API.OAuthController':handle_refresh_token_grant/2

References

Credits

Eric Meadows-Jönsson Finder Remediation developer
Jonatan Männchen / EEF Coordinator

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N
« All CVEs