CVE-2026-102271

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

Published Sep 28, 2026 CVSS 3.1 · 7.4 High EPSS < 1% KEV · Not listed
Description
PyJWT is a Python implementation of JSON Web Token standards. From 2.4.0 until 2.14.0, PyJWT HMACAlgorithm.prepare_key is affected because asymmetric-key guard relies on textual markers that are absent from DER encoding. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a DER public key as the shared verification key. As a result, PyJWT uses public DER bytes as an HMAC secret. Consequently, an attacker who knows the public key can forge authenticated HMAC tokens. This issue is fixed in version 2.14.0.

Analysis

AI-generated

Technical impact

PyJWT, between versions 2.4.0 and 2.13.x, incorrectly accepts DER‑encoded public keys as HMAC secrets when the HMACAlgorithm.prepare_key method runs. The obvious text markers used to detect asymmetric keys are missing in DER format, so the guard is bypassed. An attacker who knows the public key can compute a valid HMAC signature and forge a signed JSON Web Token that the library will treat as authentic, potentially bypassing authentication checks or granting unauthorized access.

Affected Systems

The vulnerability applies to installations of the PyJWT Python library from version 2.4.0 up to, but not including, 2.14.0. Any Python application that loads PyJWT, accepts user‑supplied JWTs, or mixes HMAC with asymmetric algorithms and supplies a DER public key as the shared verification key is at risk.

Risk and Exploitability

The CVSS score of 7.4 signals high severity. The EPSS score is currently unavailable and the flaw is not listed in CISA’s KEV catalog. If an application exposes its public key to clients or incorrectly uses that key as a shared secret, an attacker can easily generate forged tokens. The attack vector is most likely remote, leveraging any authentication interface that accepts JWTs, and does not require local exploitation or privileged access.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade PyJWT to version 2.14.0 or later so that DER public keys are no longer accepted as HMAC secrets
  • Verify that no DER‑encoded public key is passed to HMAC signing or verification routines in the application code or configuration
  • Audit the application’s token signing and verification flows to ensure separation of HMAC and asymmetric key usage, removing any accidental reuse of a public key as an HMAC secret

Generated by OpenCVE AI on September 28, 2026 at 21:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-p4g4-x82p-q773 PyJWT: Public keys in DER form are accepted as HMAC secrets, bypassing the CVE-2022-29217 guard
History
Type Values Removed Values Added
First Time appeared Pyjwt Project
Pyjwt Project pyjwt
CPEs cpe:2.3:a:pyjwt_project:pyjwt:*:*:*:*:*:*:*:*
Vendors & Products Pyjwt Project
Pyjwt Project pyjwt
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Jpadilla
Jpadilla pyjwt
Vendors & Products Jpadilla
Jpadilla pyjwt
Type Values Removed Values Added
Description PyJWT is a Python implementation of JSON Web Token standards. From 2.4.0 until 2.14.0, PyJWT HMACAlgorithm.prepare_key is affected because asymmetric-key guard relies on textual markers that are absent from DER encoding. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a DER public key as the shared verification key. As a result, PyJWT uses public DER bytes as an HMAC secret. Consequently, an attacker who knows the public key can forge authenticated HMAC tokens. This issue is fixed in version 2.14.0.
Title PyJWT: Public keys in DER form are accepted as HMAC secrets, bypassing the CVE-2022-29217 guard
Weaknesses CWE-347
References
Metrics cvssV3_1

{'score': 7.4, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N'}

Weaknesses
  • CWE-347

    Improper Verification of Cryptographic Signature

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 1, 2026, 2:57 PM
Reserved
Sep 28, 2026, 8:11 PM
Status
Analyzed
Published
Sep 28, 2026, 9:17 PM
Modified
Oct 6, 2026, 6:36 PM
Severity
Important
Public date
Sep 28, 2026, 8:31 PM