pyjwt: Use of a Broken or Risky Cryptographic Algorithm
CVE-2022-29217 is a high-severity use of a broken or risky cryptographic algorithm vulnerability in pyjwt from Jpadilla, with a CVSS 3.1 base score of 7.5 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. Affected pyjwt versions: >= 1.5.0, < 2.4.0. The record does not name a fixed version, so check the vendor advisory. There is no confirmed exploitation so far. EPSS estimates a 1.35% chance of exploitation within 30 days, higher than 72% of scored CVEs.
High severity with no evidence of exploitation so far.
What to do
- Check which version of pyjwt you run against the affected versions below, and install the vendor's latest release.
- Read the advisory on github.com for workarounds and exact fixed builds.
- Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| Jpadilla | pyjwt | >= 1.5.0, < 2.4.0 | Not stated |
| Fedora Project | Fedora | 35; 36 | Not stated |
Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.
How the severity score breaks down
- Attack vector
- NetworkCan be exploited remotely over a network, including the internet.
- Attack complexity
- LowNo special conditions are needed; the attack works reliably.
- Privileges required
- NoneNo account or login is needed.
- User interaction
- NoneNo action by a victim is required.
- Scope
- UnchangedImpact stays within the vulnerable component.
- Confidentiality
- NoneNo data is disclosed.
- Integrity
- HighData or code can be modified at will.
- Availability
- NoneAvailability is not affected.
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N. Scored by NVD.
| Scoring system | Score | Severity | Scored by |
|---|---|---|---|
| CVSS 3.1 | 7.4 | High | CNA (github.com) |
| CVSS 3.1 | 7.5 | High | NVD |
| CVSS 2.0 | 5.0 | Medium | NVD |
Official 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.
Source: the CVE record as published by its numbering authority, via NVD and CVE.org.
The underlying weakness: Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
How developers prevent this class of flaw
- Ensure that the design allows one cryptographic algorithm to be replaced with another in the next generation or version. Where possible, use wrappers to make the interfaces uniform. This will make it easier to upgrade to stronger algorithms. With hardware, design the product at the Intellectual Property (IP) level so that one cryptographic algorithm can be replaced with another in the next generation of the hardware product.
- Carefully manage and protect cryptographic keys (see CWE-320). If the keys can be guessed or stolen, then the strength of the cryptography itself is irrelevant.
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Industry-standard implementations will save development time and may be more likely to avoid errors that can occur during implementation of cryptographic algorithms. Consider the ESAPI Encryption feature.
More Use of a Broken or Risky Cryptographic Algorithm vulnerabilities (CWE-327)
Timeline
- CVE record published.
- CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: total).
- Record last changed materially (score, affected products, status or references).
References
Advisories
- github.com/jpadilla/pyjwt/security/advisories/GHSA-ffqj-6fqr-9h24Issue Tracking, Third Party Advisory
Patches and release notes
- github.com/jpadilla/pyjwt/commit/9c528670c455b8d948aff95ed50e22940d1ad3fcThird Party Advisory
- github.com/jpadilla/pyjwt/releases/tag/2.4.0Release Notes, Third Party Advisory
Other references
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/5PK7IQCBVNLYJEFTPHBB…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6HIYEYZRQEP6QTHT3EHH…
- vicarius.io/vsociety/posts/risky-algorithms-algorithm-confusion-in-pyjwt-cve-2022-29217
Other vulnerabilities in pyjwt
- 8.2 High severity
- 7.5 High severity
- 7.4 High severity
- 7.4 High severity
- 7.4 High severity
- 9.1 Critical severity
Recent Use of a Broken or Risky Cryptographic Algorithm vulnerabilities
- 7.5 High severity
- 9.1 Critical severity
- 9.8 Critical severity
- 7.5 High severity
- 8.1 High severity
Spotted an error? Tell us.