VAITP Dataset

← Back to the dataset

CVE-2026-102270

PyJWT <2.14.0 allows PEM regex backtracking, leading to CPU‑DoS.

  • CVSS 4.9
  • CWE-1333
  • Resource Management
  • Remote

PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, PyJWT is_pem_format is affected because lazy PEM regular expression backtracks extensively. This occurs when a certificate-like input contains repeated BEGIN markers without a matching END marker. As a result, is_pem_format performs unbounded backtracking while searching for a PEM end marker. Consequently, an attacker can cause intensive CPU consumption. This issue is fixed in version 2.14.0.

CVSS base score
4.9
Published
2026-09-28
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
PyJWT
Fixed by upgrading
Yes

Solution

Upgrade PyJWT to version 2.14.0 or later.

Vulnerable code sample

import jwt
from jwt.utils import is_pem_format

def load_key(pem_data: str):
    # VULNERABLE: unbounded backtracking in is_pem_format
    if not is_pem_format(pem_data):
        raise ValueError("Provided data is not PEM")
    return jwt.algorithms.RSAAlgorithm.from_jwk(pem_data)

Patched code sample

import jwt
from jwt.utils import is_pem_format

def load_key(pem_data: str):
    # FIX: use strict PEM validation to avoid backtracking
    if not is_pem_format(pem_data, strict=True):
        raise ValueError("Provided data is not PEM")
    return jwt.algorithms.RSAAlgorithm.from_jwk(pem_data)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026102270,
  title        = {{PyJWT <2.14.0 allows PEM regex backtracking, leading to CPU‑DoS.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-102270},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102270/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.