CVE-2026-102268

PyJWT: Asymmetric-PEM detection bypass: whitespace/line-ending-mutated public keys skip the HS/asymmetric confusion guard

Published Sep 28, 2026 CVSS 3.1 · 9.1 Critical EPSS < 1% KEV · Not listed
Description
PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, is_pem_format in jwt/utils.py is affected because is_pem_format does not recognize every PEM representation accepted by the cryptography loader. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a mutated public-key PEM as raw key bytes. As a result, HMACAlgorithm.prepare_key treats the unrecognized asymmetric public key 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 is a Python implementation of JSON Web Token standards. Before version 2.14.0, the function that detects a PEM format was incomplete, allowing certain public‑key PEMs to be misidentified as raw HMAC secrets. The flaw permits an attacker who knows the public key to craft a token signed with a bogus HMAC secret that the library accepts as a valid key, effectively forging authenticated tokens. This results in a complete authentication bypass and possibilites arbitrary data tampering, classified as CWE‑347.

Affected Systems

The vulnerability affects the jpadilla:pyjwt library in all releases prior to 2.14.0. Users employing any earlier version which mixes HMAC and asymmetric algorithms or supplies a mistakenly altered PEM key as the secret are impacted. The fix is issued in 2.14.0 and later releases.

Risk and Exploitability

The CVSS score of 9.1 reflects a high‑severity risk. No EPSS score is available, and the issue is not listed in the CISA KEV catalog. The attack vector is not explicitly stated, but since JSON Web Tokens are transmitted between client and server, a remote attacker could achieve token forgery by providing the public key and mutating it to bypass the guard ( the likely attack vector is remote). The recommendation is to apply the vendor patch, enforce correct key usage and apply a temporary validation filter if a delay is unavoidable.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the PyJWT library to version 2.14.0 or later, which fixes the PEM recognition bug.
  • Ensure that your application does not mix HMAC and asymmetric signing algorithms, and that public keys are supplied in a proper format.
  • If an immediate upgrade is not possible, enforce a strict check that the key provided to the HMAC algorithm matches the expected HMAC secret format and reject any key that appears to be in PEM form; this mitigates the confusion guard bypass until the patch is applied.

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

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-ffc3-869f-jxw9 PyJWT: Asymmetric-PEM detection bypass: whitespace/line-ending-mutated public keys skip the HS/asymmetric confusion 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': 'yes', '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. Prior to 2.14.0, is_pem_format in jwt/utils.py is affected because is_pem_format does not recognize every PEM representation accepted by the cryptography loader. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a mutated public-key PEM as raw key bytes. As a result, HMACAlgorithm.prepare_key treats the unrecognized asymmetric public key 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: Asymmetric-PEM detection bypass: whitespace/line-ending-mutated public keys skip the HS/asymmetric confusion guard
Weaknesses CWE-347
References
Metrics cvssV3_1

{'score': 9.1, 'vector': 'CVSS:3.1/AV:N/AC:L/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
Sep 29, 2026, 1:59 PM
Reserved
Sep 28, 2026, 8:11 PM
Status
Analyzed
Published
Sep 28, 2026, 9:17 PM
Modified
Oct 7, 2026, 8:25 PM