CVE-2026-119194: pyasn1 has quadratic CPU use in schemaless BER/CER/DER container decoding
pyasn1 versions from 0.3.3 up to 0.6.4 burn quadratic CPU time when decoding attacker-controlled BER, CER or DER data without a schema. A container holding many tags with colliding hashes slows each insertion. A repeated small request can starve a service. Fixed in pyasn1 0.6.5.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
In schemaless decoding, ConstructedPayloadDecoderBase._decodeComponentsSchemaless adds every component's TagSet to a growing set. It only needs to know whether there is one tag set or two or more. An attacker picks long tag IDs whose TagSet hashes collide, so each new insertion compares against all earlier entries. CPU time grows with the square of the component count. The CER and DER decoders inherit the path.
The reporter measured it on pyasn1 0.6.4 with CPython 3.12.10. Going from 3,200 to 6,400 colliding components raised decode time from 0.438 s to 1.747 s. A comparable non-colliding control went from 0.031 s to 0.065 s. The input is valid and decodes to the right values, so format checks do not catch it.
The risk is availability only. Any network service that passes untrusted bytes to decoder.decode() with no asn1Spec is exposed, for example parsers for certificates, LDAP or SNMP messages built on pyasn1. No confidentiality or integrity impact was shown. Repeated requests can tie up CPU and slow or stop the service.
Who is affected
The pip package pyasn1, versions >= 0.3.3 and < 0.6.5. Only code that decodes untrusted BER, CER or DER without a schema takes the vulnerable path. Check the installed version:
pip show pyasn1Also check packages that depend on pyasn1, such as ldap and SNMP libraries, with pip list | grep -i pyasn1 inside each virtualenv or container image.
pyasn1
- Ecosystem
- PyPI
- Affected
- >= 0.3.3, < 0.6.5
- Fixed in
- 0.6.5
- Check
pip show pyasn1
How to fix it
Upgrade to pyasn1 0.6.5.
pip install --upgrade "pyasn1>=0.6.5"The fix stops growing the classification set once it holds two distinct tag sets, while keeping every decoded component and its order. Release 0.6.5 also removes other quadratic paths in binary REAL, constructed BIT STRING, OCTET STRING and ANY decoding. The sources give no workaround. If you cannot upgrade, supply an ASN.1 schema when decoding, or cap input size before decoding.
How to tell if you were hit
Look for worker processes pinned at high CPU after receiving small BER, DER or CER messages, and for requests that take seconds to decode. Profile for time spent in pyasn1.codec.ber.decoder, specifically _decodeComponentsSchemaless. Look for repeated requests from one source with unusually many long-form tags (tag byte 0xbf followed by multi-byte tag IDs). Run pip show pyasn1 across images and virtualenvs to find versions below 0.6.5.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
When an application decodes attacker-controlled BER, CER, or DER data without an ASN.1 schema, a container with many distinct long tag IDs can cause quadratic CPU use. Repeated inputs can exhaust CPU and reduce service availability.
Details
ConstructedPayloadDecoderBase._decodeComponentsSchemaless inserts every decoded component’s TagSet into a growing set, although it only needs to distinguish one tag set from two or more. Attacker-chosen tag IDs can have colliding TagSet hashes, making each later insertion compare against an increasing number of earlier tags. This path is present in v0.6.4 and is inherited by the CER and DER decoders. The proposed fix stops growing the classification set after it contains two distinct tag sets, while retaining every decoded component and its order. On v0.6.4 with CPython 3.12.10, increasing the collision input from 3,200 to 6,400 components raised decode CPU time from 0.438 to 1.747 seconds; a comparable control rose from 0.031 to 0.065 seconds. Both inputs decoded successfully with the expected values and an empty remainder.
Proof of concept
Run this outside the repository checkout in a fresh Python 3.12 environment with pyasn1==0.6.4 installed:
import sys
import time
from pyasn1.codec.ber import decoder
from pyasn1.type import univ
def enc_tag(tag_id):
groups = [tag_id & 0x7f]
tag_id >>= 7
while tag_id:
groups.append((tag_id & 0x7f) | 0x80)
tag_id >>= 7
return b'\xbf' + bytes(reversed(groups))
def payload(tag_ids):
body = b''.join(enc_tag(tag_id) + b'\x03\x04\x01A'
for tag_id in tag_ids)
length = len(body).to_bytes((len(body).bit_length() + 7) // 8, 'big')
return b'\x30' + bytes([0x80 | len(length)]) + length + body
for count in (3200, 6400):
cases = (
("collision", [32 + i * sys.hash_info.modulus
for i in range(count)]),
("control", [(1 << 70) + i for i in range(count)]),
)
for name, tag_ids in cases:
wire = payload(tag_ids)
start = time.process_time()
value, remainder = decoder.decode(wire)
cpu_seconds = time.process_time() - start
assert type(value) is univ.Sequence
assert len(value) == count and remainder == b''
for position, tag_id in enumerate(tag_ids):
component = value.getComponentByPosition(position)
assert component.asOctets() == b'A'
assert component.tagSet[-1].tagId == tag_id
print(count, name, len(wire), round(cpu_seconds, 3))Impact
Applications that pass attacker-controlled bytes to schemaless BER, CER, or DER decoding can spend disproportionate CPU time on a relatively small, valid input. The demonstrated impact is availability; no confidentiality or integrity impact was observed.
Credited to droideck.
Questions
- Is pyasn1 0.6.4 affected by CVE-2026-119194?
Yes. The affected range is >= 0.3.3 and < 0.6.5, so 0.6.4 is vulnerable. Upgrade to 0.6.5.
- Can this lead to code execution or data theft?
No. The demonstrated impact is CPU exhaustion only. The reporter saw no confidentiality or integrity impact.
- Am I safe if I decode with an ASN.1 schema?
The flaw is in the schemaless container path, so schema-driven decoding does not use the vulnerable function. Upgrading is still the clean fix.
- Is it exploited in the wild?
No source says so, and the entry is not in CISA's KEV catalog. A public proof of concept is in the advisory.
References
Read for this analysis:
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-119195
pyasn1 has quadratic-time denial of service in constructed string and indefinite-length ANY decoding
high7.5Oct 30, 2026CVE-2026-119196
pyasn1 has quadratic CPU consumption in constructed BIT STRING decoding
high7.5Oct 30, 2026CVE-2026-119197
pyasn1 has quadratic-complexity denial of service in binary REAL decoding
high7.5Oct 30, 2026CVE-2026-59884
pyasn1 BER/CER/DER decoder denial of service via unbounded long-form tag IDs
high7.5Jul 21, 2026CVE-2026-59885
pyasn1: Quadratic complexity in OBJECT IDENTIFIER and RELATIVE-OID processing allows denial of service
high7.5Jul 21, 2026CVE-2026-59886
pyasn1: Uncontrolled resource consumption when converting decoded REAL values
high7.5Jul 21, 2026
