Impact
PyJWT, between versions 2.4.0 and 2.13.x, incorrectly accepts DER‑encoded public keys as HMAC secrets when the HMACAlgorithm.prepare_key method runs. The obvious text markers used to detect asymmetric keys are missing in DER format, so the guard is bypassed. An attacker who knows the public key can compute a valid HMAC signature and forge a signed JSON Web Token that the library will treat as authentic, potentially bypassing authentication checks or granting unauthorized access.
Affected Systems
The vulnerability applies to installations of the PyJWT Python library from version 2.4.0 up to, but not including, 2.14.0. Any Python application that loads PyJWT, accepts user‑supplied JWTs, or mixes HMAC with asymmetric algorithms and supplies a DER public key as the shared verification key is at risk.
Risk and Exploitability
The CVSS score of 7.4 signals high severity. The EPSS score is currently unavailable and the flaw is not listed in CISA’s KEV catalog. If an application exposes its public key to clients or incorrectly uses that key as a shared secret, an attacker can easily generate forged tokens. The attack vector is most likely remote, leveraging any authentication interface that accepts JWTs, and does not require local exploitation or privileged access.
OpenCVE Enrichment
Github GHSA