CVE-2017-11424: PyJWT - Symmetric/Asymmetric Key Confusion
Summary
CVE-2017-11424: In PyJWT 1.5.0 and below the invalid_strings check in HMACAlgorithm.prepare_key does not account for all PEM encoded public keys. Affects pyjwt versions < 1.5.1. Fixed in 1.5.1. How to fix ↓
Also tracked for
- pyjwt · Debian:11
The same CVE-2017-11424 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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 for encoding and decoding JSON Web Tokens (JWTs). JWTs are used for securely transmitting information between parties as a JSON object. PyJWT provides functionality for generating, signing, and verifying JWTs. It is widely used in Python applications for implementing authentication and authorization mechanisms.
Vulnerability Detail
The vulnerability (CVE-2017-11424) exists in PyJWT versions 1.5.0 and below. It stems from the invalid_strings check in the HMACAlgorithm.prepare_key function, which fails to account for all PEM encoded public keys. Specifically, the PKCS1 PEM encoded format is allowed because it is prefaced with the string -----BEGIN RSA PUBLIC KEY-----, which is not considered an invalid string. This oversight enables symmetric/asymmetric key confusion attacks against users utilizing PKCS1 PEM encoded public keys. An attacker can craft JWTs from scratch, potentially leading to unauthorized access, data tampering, or other security breaches.
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
1.5.1
This is the first release that contains the fix.
pip install --upgrade "pyjwt==1.5.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. Upgrading to the fixed version is the recommended solution.
Conclusion
The vulnerability in PyJWT versions 1.5.0 and below allows for symmetric/asymmetric key confusion attacks against users utilizing PKCS1 PEM encoded public keys. Upgrading to PyJWT version 1.5.1 or above is necessary to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for pyjwt →
FAQ
PyJWT is a Python library for encoding, decoding, and manipulating JSON Web Tokens (JWTs). It is commonly used in Python applications for implementing authentication and authorization mechanisms.
A JSON Web Token (JWT) is a compact, URL-safe means of representing claims between two parties. It consists of three parts: a header, a payload, and a signature. JWTs are commonly used for authentication and authorization purposes in web applications.
The vulnerability allows for symmetric/asymmetric key confusion attacks against users using PKCS1 PEM encoded public keys. This can lead to unauthorized access, data tampering, or other security breaches.
You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the Pipfile.lock file.
No, there is no known workaround for this vulnerability. Upgrading to the fixed version of PyJWT is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for pyjwt.