Impact
PyJWT versions 2.9.0 through 2.12.1 allow a bypass of the algorithm allow‑list when the jwt.decode() or jwt.decode_complete() functions are called with a PyJWK key. In this flow the token header algorithm is compared with a caller‑supplied list of allowed algorithms, yet the signature is verified using the algorithm that is bound to the PyJWK object instead of the header value. An attacker who can obtain a private key for a registered JWK/JWKS can sign a token with a disallowed algorithm, advertise an allowed algorithm in the header, and have the token accepted by the application. This flaw is a case of improper verification and is identified as CWE‑347, potentially allowing an attacker to forge authentication tokens.
Affected Systems
PyJWT – the popular Python JSON Web Token library – is affected for all releases from 2.9.0 to 2.12.1 inclusive. The issue specifically impacts the documented PyJWKClient.get_signing_key_from_jwt flow, which developers use to retrieve signing keys from JWKS endpoints.
Risk and Exploitability
The CVSS score of 5.4 indicates a moderate severity. The EPSS score is not reported and the vulnerability is not listed in CISA’s KEV catalog. Exploitation requires control of a registered private JWK key. If an attacker can supply a forged JWT with a disallowed algorithm yet advertise a permitted one, the application will accept the token, effectively bypassing authentication. The attack vector is typically an in‑application JWT validation path rather than an external network service, making it most relevant to applications that trust third‑party JWKs without strict algorithm verification.
OpenCVE Enrichment
Github GHSA