CVE-2022-29217: CWE-327: Use of a Broken or Risky Cryptographic Algorithm in jpadilla pyjwt
PyJWT is a Python implementation of RFC 7519. PyJWT supports multiple different JWT signing algorithms. With JWT, an attacker submitting the JWT token can choose the used signing algorithm. The PyJWT library requires that the application chooses what algorithms are supported. The application can specify `jwt.algorithms.get_default_algorithms()` to get support for all algorithms, or specify a single algorithm. The issue is not that big as `algorithms=jwt.algorithms.get_default_algorithms()` has to be used. Users should upgrade to v2.4.0 to receive a patch for this issue. As a workaround, always be explicit with the algorithms that are accepted and expected when decoding.
AI Analysis
Technical Summary
CVE-2022-29217 is a vulnerability identified in the PyJWT library, a widely used Python implementation of JSON Web Tokens (JWT) as defined by RFC 7519. JWTs are commonly used for securely transmitting information between parties as a JSON object, and they rely on cryptographic signing algorithms to ensure the integrity and authenticity of the token. PyJWT supports multiple signing algorithms, and the library allows the application to specify which algorithms are accepted when decoding tokens. The vulnerability arises when an application uses the default setting `jwt.algorithms.get_default_algorithms()` without explicitly restricting the accepted algorithms. This default includes some cryptographic algorithms considered broken or risky (CWE-327), which can be exploited by an attacker who crafts a JWT token specifying a weak or insecure signing algorithm. By doing so, the attacker may bypass signature verification, potentially allowing token forgery or manipulation. The issue affects PyJWT versions from 1.5.0 up to but not including 2.4.0. The recommended mitigation is to upgrade to version 2.4.0 or later, where the vulnerability is patched. Alternatively, applications should explicitly specify and restrict the accepted algorithms when decoding JWTs rather than relying on the default set. This vulnerability does not require user interaction or authentication to exploit, but it does require the attacker to submit a crafted JWT token to the application. There are no known exploits in the wild reported to date. The vulnerability primarily impacts the confidentiality and integrity of systems relying on PyJWT for authentication or authorization mechanisms, as compromised tokens could lead to unauthorized access or privilege escalation.
Potential Impact
For European organizations, the impact of this vulnerability can be significant, especially for those relying on PyJWT for securing APIs, web applications, or microservices architectures. Exploitation could allow attackers to forge JWT tokens, bypass authentication controls, and gain unauthorized access to sensitive data or systems. This could lead to data breaches, unauthorized transactions, or disruption of services. Sectors such as finance, healthcare, government, and critical infrastructure that use JWT for identity and access management are particularly at risk. The vulnerability undermines the integrity and confidentiality of authentication tokens, potentially enabling lateral movement within networks or privilege escalation. Given the widespread use of Python and PyJWT in modern web applications, the scope of affected systems is broad. However, the absence of known exploits in the wild suggests that exploitation is not yet widespread, though the risk remains high if unpatched. Organizations failing to upgrade or explicitly restrict algorithms expose themselves to potential compromise, regulatory non-compliance, and reputational damage.
Mitigation Recommendations
1. Immediate upgrade of PyJWT to version 2.4.0 or later, where the vulnerability is patched. 2. Review all applications using PyJWT to ensure that the decoding of JWT tokens explicitly specifies accepted algorithms rather than relying on the default set. For example, use `jwt.decode(token, key, algorithms=['HS256'])` to restrict to secure algorithms. 3. Conduct code audits to identify any instances where `jwt.algorithms.get_default_algorithms()` or similar default settings are used and replace them with explicit algorithm lists. 4. Implement additional token validation layers such as token expiration checks, issuer validation, and audience restrictions to reduce the risk of token misuse. 5. Monitor application logs for suspicious JWT tokens or authentication anomalies that could indicate attempted exploitation. 6. Educate developers and security teams about secure JWT handling practices and the risks of using weak cryptographic algorithms. 7. For critical systems, consider implementing Web Application Firewalls (WAFs) or API gateways that can enforce strict JWT validation policies. These measures go beyond generic advice by focusing on explicit algorithm restriction, code auditing, and layered validation controls.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland, Belgium, Finland
CVE-2022-29217: CWE-327: Use of a Broken or Risky Cryptographic Algorithm in jpadilla pyjwt
Description
PyJWT is a Python implementation of RFC 7519. PyJWT supports multiple different JWT signing algorithms. With JWT, an attacker submitting the JWT token can choose the used signing algorithm. The PyJWT library requires that the application chooses what algorithms are supported. The application can specify `jwt.algorithms.get_default_algorithms()` to get support for all algorithms, or specify a single algorithm. The issue is not that big as `algorithms=jwt.algorithms.get_default_algorithms()` has to be used. Users should upgrade to v2.4.0 to receive a patch for this issue. As a workaround, always be explicit with the algorithms that are accepted and expected when decoding.
AI-Powered Analysis
Technical Analysis
CVE-2022-29217 is a vulnerability identified in the PyJWT library, a widely used Python implementation of JSON Web Tokens (JWT) as defined by RFC 7519. JWTs are commonly used for securely transmitting information between parties as a JSON object, and they rely on cryptographic signing algorithms to ensure the integrity and authenticity of the token. PyJWT supports multiple signing algorithms, and the library allows the application to specify which algorithms are accepted when decoding tokens. The vulnerability arises when an application uses the default setting `jwt.algorithms.get_default_algorithms()` without explicitly restricting the accepted algorithms. This default includes some cryptographic algorithms considered broken or risky (CWE-327), which can be exploited by an attacker who crafts a JWT token specifying a weak or insecure signing algorithm. By doing so, the attacker may bypass signature verification, potentially allowing token forgery or manipulation. The issue affects PyJWT versions from 1.5.0 up to but not including 2.4.0. The recommended mitigation is to upgrade to version 2.4.0 or later, where the vulnerability is patched. Alternatively, applications should explicitly specify and restrict the accepted algorithms when decoding JWTs rather than relying on the default set. This vulnerability does not require user interaction or authentication to exploit, but it does require the attacker to submit a crafted JWT token to the application. There are no known exploits in the wild reported to date. The vulnerability primarily impacts the confidentiality and integrity of systems relying on PyJWT for authentication or authorization mechanisms, as compromised tokens could lead to unauthorized access or privilege escalation.
Potential Impact
For European organizations, the impact of this vulnerability can be significant, especially for those relying on PyJWT for securing APIs, web applications, or microservices architectures. Exploitation could allow attackers to forge JWT tokens, bypass authentication controls, and gain unauthorized access to sensitive data or systems. This could lead to data breaches, unauthorized transactions, or disruption of services. Sectors such as finance, healthcare, government, and critical infrastructure that use JWT for identity and access management are particularly at risk. The vulnerability undermines the integrity and confidentiality of authentication tokens, potentially enabling lateral movement within networks or privilege escalation. Given the widespread use of Python and PyJWT in modern web applications, the scope of affected systems is broad. However, the absence of known exploits in the wild suggests that exploitation is not yet widespread, though the risk remains high if unpatched. Organizations failing to upgrade or explicitly restrict algorithms expose themselves to potential compromise, regulatory non-compliance, and reputational damage.
Mitigation Recommendations
1. Immediate upgrade of PyJWT to version 2.4.0 or later, where the vulnerability is patched. 2. Review all applications using PyJWT to ensure that the decoding of JWT tokens explicitly specifies accepted algorithms rather than relying on the default set. For example, use `jwt.decode(token, key, algorithms=['HS256'])` to restrict to secure algorithms. 3. Conduct code audits to identify any instances where `jwt.algorithms.get_default_algorithms()` or similar default settings are used and replace them with explicit algorithm lists. 4. Implement additional token validation layers such as token expiration checks, issuer validation, and audience restrictions to reduce the risk of token misuse. 5. Monitor application logs for suspicious JWT tokens or authentication anomalies that could indicate attempted exploitation. 6. Educate developers and security teams about secure JWT handling practices and the risks of using weak cryptographic algorithms. 7. For critical systems, consider implementing Web Application Firewalls (WAFs) or API gateways that can enforce strict JWT validation policies. These measures go beyond generic advice by focusing on explicit algorithm restriction, code auditing, and layered validation controls.
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-04-13T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9843c4522896dcbf2fc8
Added to database: 5/21/2025, 9:09:23 AM
Last enriched: 6/23/2025, 8:20:36 AM
Last updated: 2/7/2026, 11:07:18 AM
Views: 49
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-2083: SQL Injection in code-projects Social Networking Site
MediumCVE-2026-2082: OS Command Injection in D-Link DIR-823X
MediumCVE-2026-2080: Command Injection in UTT HiPER 810
HighCVE-2026-2079: Improper Authorization in yeqifu warehouse
MediumCVE-2026-1675: CWE-1188 Initialization of a Resource with an Insecure Default in brstefanovic Advanced Country Blocker
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.