CVE-2026-102273: PyJWT Vulnerability in HMAC Secret Handling
Summary
CVE-2026-102273: PyJWT accepts public JWK containers as HMAC secrets. Affects pyjwt versions >= 2.13.0, < 2.14.0. Fixed in 2.14.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
PyJWT is a Python library that allows developers to encode and decode JSON Web Tokens (JWTs). It supports various algorithms for signing and verifying tokens, including HMAC and asymmetric algorithms like RSA and EC. The library is widely used for authentication and authorization in web applications. However, a vulnerability was discovered in version 2.13.0 that affects how HMAC secrets are handled when mixed with public JWK containers, potentially leading to security risks.
Vulnerability Detail
The vulnerability arises from an incomplete defense against algorithm confusion in PyJWT 2.13.0. When an application allows both symmetric (HMAC) and asymmetric algorithms in the same verification path, a public JWK (JSON Web Key) can be mistakenly accepted as an HMAC secret. This occurs when the JWK is wrapped in a JWKS object or represented in a nested container without exposing a top-level 'kty' member. An attacker with knowledge of the public key material can forge HS256, HS384, or HS512 tokens, leading to unauthorized access or manipulation of JWT claims. This issue does not affect applications that maintain separate verification paths for symmetric and asymmetric algorithms.
How To Fix
Latest published version: 2.15.1 as of 23 Oct 2026
pip install --upgrade "pyjwt==2.15.1"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.14.0
This is the first release that contains the fix.
pip install --upgrade "pyjwt==2.14.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, ensure that your application does not mix symmetric and asymmetric algorithms in the same verification path. Additionally, avoid passing raw public JWK or JWKS JSON as the key parameter for HMAC verification.
Conclusion
The vulnerability CVE-2026-102273 in PyJWT poses significant security risks by allowing public JWKs to be accepted as HMAC secrets. It is crucial for developers to update to version 2.14.0 or later to mitigate this risk and ensure the integrity of JWT handling in their applications.
See every vulnerability recorded for pyjwt →
FAQ
An attacker can forge JWT tokens if the application improperly handles public JWKs as HMAC secrets, potentially leading to unauthorized access.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
The affected version is 2.13.0. The vulnerability is fixed in version 2.14.0 and later.
As a temporary measure, ensure that your application does not mix HMAC and asymmetric algorithms and avoid using public JWKs as HMAC secrets.
The CVSS score for this vulnerability is 7.4, indicating a high severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for pyjwt.