VAITP Dataset

← Back to the dataset

CVE-2026-119197

Quadratic-time REAL decoding DoS in pyasn1 before 0.6.5 due to large mantissa.

  • CVSS 7.5
  • CWE-407
  • Resource Management
  • Remote

pyasn1 is a generic ASN.1 library for Python. Prior to 0.6.5, binary REAL decoding builds a large mantissa one octet at a time by shifting a growing integer and slicing the remaining byte string. Attacker-controlled ASN.1 includes a binary-encoded REAL with a large mantissa and reaches BER, CER, or DER decode(), with or without a schema containing REAL. RealPayloadDecoder.valueDecoder repeatedly performs a left shift, OR, and suffix copy for every mantissa octet, making decode time quadratic in mantissa length. A comparatively small REAL value can hold a decoding worker on one CPU core for seconds or longer and cause availability loss. This issue is fixed in version 0.6.5.

CVSS base score
7.5
Published
2026-10-29
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
pyasn1
Fixed by upgrading
Yes

Solution

Upgrade pyasn1 to version 0.6.5 or later.

Vulnerable code sample

import sys
from pyasn1.codec.ber import decoder
from pyasn1.type.univ import Real

def parse_real(asn1_bytes):
    # VULNERABLE: quadratic decode of large REAL mantissa
    decoded, _ = decoder.decode(asn1_bytes, asn1Spec=Real())
    return float(decoded)

def main():
    data = bytes.fromhex(sys.argv[1])
    value = parse_real(data)
    # further processing...

Patched code sample

import sys
from pyasn1.codec.ber import decoder
from pyasn1.type.univ import Real

MAX_REAL_PAYLOAD = 1024  # bytes

def parse_real(asn1_bytes):
    # FIX: reject overly large REAL payloads before decode
    if len(asn1_bytes) > MAX_REAL_PAYLOAD:
        raise ValueError("REAL payload exceeds safe size")
    decoded, _ = decoder.decode(asn1_bytes, asn1Spec=Real())
    return float(decoded)

def main():
    data = bytes.fromhex(sys.argv[1])
    value = parse_real(data)
    # further processing...

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:cve2026119197,
  title        = {{Quadratic-time REAL decoding DoS in pyasn1 before 0.6.5 due to large mantissa.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-119197},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119197/}}
}

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.