Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. PyJWT
  4. ›
  5. CVE-2026-102271

CVE-2026-102271: PyJWT: Public keys in DER form are accepted as HMAC secrets, bypassing the CVE-2022-29217 guard

September 29, 2026

HMACAlgorithm.prepare_key blocks asymmetric keys from being used as HMAC secrets by searching for text markers only. It looks for -----BEGIN and for an ssh- prefix. The same key in DER form is binary ASN.1 and has neither marker, so it passes the check and is used as an HMAC secret.

An application that verifies tokens with an RSA or EC public key, and also allows HS256 with that same key, can be given a forged token. The attacker signs it with the public key, which is public. This is the key confusion problem CVE-2022-29217 was filed for, reachable again through a different encoding.

The reach is smaller than the original CVE. The application must already be in that misconfiguration, and it must hold its public key as DER bytes rather than PEM.

References

  • github.com/advisories/GHSA-p4g4-x82p-q773
  • github.com/jpadilla/pyjwt/commit/2798504fa2663364573cf2d1043d8d7fef389499
  • github.com/jpadilla/pyjwt/releases/tag/2.14.0
  • github.com/jpadilla/pyjwt/security/advisories/GHSA-p4g4-x82p-q773
  • nvd.nist.gov/vuln/detail/CVE-2026-102271

Code Behaviors & Features

Detect and mitigate CVE-2026-102271 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.4.0 before 2.14.0

Fixed versions

  • 2.14.0

Solution

Upgrade to version 2.14.0 or above.

Impact 7.4 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-347: Improper Verification of Cryptographic Signature

Source file

pypi/PyJWT/CVE-2026-102271.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Mon, 12 Oct 2026 00:23:26 +0000.