CVE-2026-119195
Quadratic CPU consumption via fragmented ASN.1 strings in pyasn1 <0.6.5.
- CVSS 7.5
- CWE-407
- Resource Management
- Remote
pyasn1 is a generic ASN.1 library for Python. Prior to 0.6.5, constructed string and indefinite-length ANY decoding repeatedly concatenates each fragment onto a growing bytes value. Attacker-controlled BER or CER data can use many constructed OCTET STRING or character-string fragments. DER rejects constructed OCTET STRING without a schema, but accepts its definite-length form when asn1Spec selects univ.OctetString; it also accepts constructed character strings such as UTF8String without a schema, even though those encodings are not valid DER. The separate indefinite-length ANY path is reachable in BER and CER when asn1Spec selects univ.Any; DER rejects indefinite lengths. OctetStringPayloadDecoder uses growing header concatenation and AnyPayloadDecoder.indefLenValueDecoder uses growing chunk concatenation, repeatedly copying an increasing prefix and causing quadratic work. A sufficiently fragmented value can occupy decoding workers and cause CPU exhaustion without confidentiality or integrity impact. This issue is fixed in version 0.6.5.
- CWE
- CWE-407
- 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
from pyasn1.codec.ber import decoder
from pyasn1.type import univ
def decode_payload(data: bytes):
# VULNERABLE: uses indefinite-length ANY decoder leading to quadratic concatenation
value, _ = decoder.decode(data, asn1Spec=univ.Any())
return valuePatched code sample
from pyasn1.codec.ber import decoder
from pyasn1.type import univ
def decode_payload(data: bytes):
# FIX: uses concrete OctetString type to avoid indefinite-length ANY path
value, _ = decoder.decode(data, asn1Spec=univ.OctetString())
return valuePublished 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.
- Remove quadratic constructed OCTET STRING and ANY reassembly (pyasn1/pyasn1)
pyasn1/codec/ber/decoder.py · AnyPayloadDecoder.indefLenValueDecoder,pyasn1/codec/ber/decoder.py · OctetStringPayloadDecoder.indefLenValueDecoder,pyasn1/codec/ber/decoder.py · OctetStringPayloadDecoder.valueDecoder
Cite this entry
@misc{vaitp:cve2026119195,
title = {{Quadratic CPU consumption via fragmented ASN.1 strings in pyasn1 <0.6.5.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-119195},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119195/}}
}
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 ::
