GHSA-9v7f-9g4p-ffgj: Infoleak
Summary
PyJWT 2.13.0 PyJWKClient followed HTTP redirects while fetching a JWKS, without validating the redirect destination. A configured trusted endpoint could therefore redirect the client to a different host.
Impact
When an application uses PyJWKClient with caller-supplied request headers and an attacker can influence the configured endpoint's response, the redirected request could expose those headers and the redirected response could be used as authoritative key material. This could cause JWKS trust poisoning and, in affected mixed-configuration applications, forged JWT acceptance. The issue requires an attacker-influenced redirect from the configured JWKS endpoint; it is not triggered by a token kid alone.
Affected versions
PyJWT <= 2.13.0.
Fix
The issue is fixed on master in commit 0a795b8e1f6ef08f634aa7086fc41cc6d5ce3e56. PyJWKClient now disables automatic redirects for JWKS fetches. Regression tests verify that a redirect is rejected without contacting its destination, while normal fetches, headers, caching, errors, timeouts, and SSL context remain covered.
The fix is present in the unreleased development branch. The patched version will be recorded after a released PyJWT 2.x version containing the fix is confirmed.
Credit
Credit: the original reporter of GHSA-9v7f-9g4p-ffgj. Additional redirect header-leak and cache-poisoning evidence from the newer duplicate report GHSA-43g3-98cx-x446 is preserved in the duplicate record and informed this canonical advisory update.
Maintainer update — 2026-09-11
The verified fix for this advisory is included in PyJWT 2.14.0, released on 2026-09-11 and available on PyPI. PyJWT 2.14.0 is the first release containing the fix. This advisory is now published with 2.14.0 recorded as the patched version.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/PyJWTto a version that resolves this vulnerability.Fixed in 2.14.0 - Upgrade
Upgrade
PyJWTto a version that resolves this vulnerability.Fixed in 2.14.0
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Deployments using PyJWT 2.13.0 or earlier and PyJWKClient to retrieve JWKS are affected. Exploitation additionally depends on the application supplying request headers and an attacker being able to influence a redirect response from the configured trusted JWKS endpoint.
Can an attacker trigger this solely by choosing a JWT kid value?
No. The issue requires an attacker-influenced redirect from the configured JWKS endpoint; a token kid value alone does not trigger it.
What could an attacker gain from a successful redirect?
The redirected request could disclose caller-supplied headers to the redirect destination. The destination's JWKS response could also be treated as authoritative key material, enabling JWKS trust poisoning and, in affected mixed-configuration applications, acceptance of forged JWTs.
What mitigation is available if an upgrade is not immediately possible?
Avoid configurations where PyJWKClient sends caller-supplied request headers and ensure the configured JWKS endpoint cannot be induced to return attacker-controlled redirects. The upstream fix disables automatic redirects for JWKS fetches.
How can I determine whether a deployment is affected?
Check whether the application uses PyJWKClient with PyJWT 2.13.0 or earlier, and inspect its JWKS fetch configuration for caller-supplied headers. Also determine whether the configured JWKS endpoint can return redirects influenced by an attacker.