Improper Verification of Cryptographic Signature in pyjwt - CVE-2026-102272
Published: November 3, 2026
Vulnerability details
The vulnerability allows a remote attacker to bypass authentication and authorization by forging JWTs containing arbitrary claims.
The vulnerability exists due to improper verification of cryptographic signatures in PyJWT's HMACAlgorithm.prepare_key() function in jwt/algorithms.py when processing BOM-prefixed RSA public JWK bytes. The bytes.lstrip() call removes only ASCII whitespace, allowing a UTF-8 byte order mark to bypass the JSON-prefix check and cause public key bytes to be accepted as an HMAC secret. A remote attacker can sign and submit an HS256 JWT using the verifier's known BOM-prefixed public JWK bytes as the secret to have arbitrary claims accepted and bypass authentication and authorization.
Exploitation requires the verifier to allow both an asymmetric algorithm and an HMAC algorithm.
Affected software
Ubuntu
python-jwt (Ubuntu package)
python3-jwt (Ubuntu package)
How to mitigate CVE-2026-102272
python-jwt (Ubuntu package) - addressed in versions 1.3.0-1ubuntu0.1+esm3, 1.5.3+ds1-1ubuntu0.1+esm3
python3-jwt (Ubuntu package) - addressed in versions 1.3.0-1ubuntu0.1+esm3, 1.5.3+ds1-1ubuntu0.1+esm3, 1.7.1-2ubuntu2.1+esm3, 2.3.0-1ubuntu0.5, 2.7.0-1ubuntu0.3, 2.10.1-4ubuntu1.2