OAuth credentials can leak across cross-origin redirects
Published: October 26, 2026
SECURITY IDENTIFIERS
- GHSA: GHSA-h4fh-g8xf-8255
- Vendor Advisory: https://github.com/ruby-oauth/oauth2/security/advisories/GHSA-h4fh-g8xf-8255
GEM
SEVERITY
CVSS v3.x: 9.3 (Critical)
UNAFFECTED VERSIONS
< 1.4.0
>= 1.5, < 2.0.22
PATCHED VERSIONS
>= 1.4.12, < 1.5
>= 2.1.0
DESCRIPTION
Summary
OAuth2::Client#request follows cross-origin HTTP redirects (301, 302, 303,
307). The redirect hardening shipped in 2.0.22 for CVE-2026-54603 /
GHSA-pp92-crg2-gfv9 added sanitize_redirect_options, which strips only
the Authorization request header.
The leak occurs under the default configuration (token_method: :post,
auth_scheme: :basic_auth): the default token refresh sends the long-lived
refresh_token in the POST body.
Affected Versions / Fixed In
- Vulnerable:
oauth2>= 2.0.22, < 2.1.0(the header-only sanitizer was introduced by the 2.0.22 fix; versions<= 2.0.21are covered by CVE-2026-54603 itself). - Vulnerable on the 1.4.x line:
oauth2>= 1.4.0, < 1.4.12. - Fixed:
1.4.12and2.1.0. Version2.1.0rejects cross-origin redirects by default before any credential channel can be replayed. - 2.0.26 ships the protection as an opt-in for compatibility: set
allow_cross_origin_redirects: falseonOAuth2::Client.newto get the 2.1.0 behavior. On 2.0.26 with the default option value the client remains vulnerable. - Interim mitigation (any version):
max_redirects: 0disables redirect following entirely.
The Fix
OAuth2::Client gains an allow_cross_origin_redirects option, defaulting to
false in 2.1.0. When a redirect crosses scheme, host, or port, the client
raises OAuth2::CrossOriginRedirectError (an OAuth2::Error subclass with
stable code == "cross_origin_redirect_blocked") before the request is
replayed — covering headers, body, query params, and connection defaults
alike, per RFC 6749 §3.2, RFC 9700 (OAuth 2.0 Security BCP) §§2.1 and 4.12,
and draft-ietf-oauth-v2-1 §7.5.3. The error message never includes the
redirect Location value and the redirect response body is never parsed.
Same-origin redirects continue to work; allow_cross_origin_redirects: true
restores the legacy behavior (and its risk) where a trusted cross-origin
target genuinely requires it — in that case configure the final HTTPS endpoint
directly where possible, and never rely on credential stripping.
