VAITP Dataset

← Back to the dataset

CVE-2026-133426

DoS via unchecked exponent strings in Fraction fields causing unbounded integer powers.

  • CVSS 6.3
  • CWE-400
  • Resource Management
  • Remote

Validating an untrusted string in exponent notation into a Fraction field computes the full power of ten without any bound: an input of a few bytes takes seconds to validate. String inputs are passed to the Fraction constructor. For strings in exponent notation (e.g. '1e8000000'), CPython computes the corresponding power of ten as an integer (in Lib/fractions.py). The issue was fixed in commit 69ed168e9ad465eef4c8d81efb152a93b604daf5. For strings in exponent notation, the exponent is now parsed before calling the Fraction constructor, and exponents larger than 4300 (in absolute value) are rejected. Impact: denial of service through validation of untrusted input. Affected are applications validating untrusted strings into Fraction fields (in both JSON and Python mode, including in strict mode), using Pydantic from 2.10.0 up to (but excluding) 2.14.0. From 2.14.0, exponents larger than 4300 (in absolute value) are rejected, matching the maximum number of digits accepted for integers.

CVSS base score
6.3
Published
2026-11-20
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade Pydantic to version 2.14.0 or later.

Vulnerable code sample

from fractions import Fraction
from pydantic import BaseModel, ValidationError

class DataModel(BaseModel):
    amount: Fraction

def load(data: str):
    # VULNERABLE: untrusted exponent string passed directly to Fraction
    try:
        return DataModel.model_validate_json(data)
    except ValidationError as e:
        raise ValueError(e)

Patched code sample

from fractions import Fraction
from pydantic import BaseModel, ValidationError, field_validator

class DataModel(BaseModel):
    amount: Fraction

    @field_validator('amount')
    @classmethod
    # FIX: reject overly large exponents before constructing Fraction
    def limit_exponent(cls, v: str) -> Fraction:
        if isinstance(v, str) and ('e' in v or 'E' in v):
            base, exp = v.lower().split('e', 1)
            # strip sign
            if exp.lstrip('+-').isdigit():
                if abs(int(exp)) > 4300:
                    raise ValueError('exponent too large')
        return Fraction(v)

def load(data: str):
    try:
        return DataModel.model_validate_json(data)
    except ValidationError as e:
        raise ValueError(e)

Cite this entry

@misc{vaitp:cve2026133426,
  title        = {{DoS via unchecked exponent strings in Fraction fields causing unbounded integer powers.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-133426},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-133426/}}
}

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.