Attacker-supplied fragmented ASN.1 strings can exhaust pyasn1 decoder CPU
GitHub Advisory Database reports that decoding attacker-controlled BER or CER ASN.1 made of many small string fragments can make pyasn1 spend quadratic CPU time and exhaust a decoding worker. Pyasn1 versions through 0.6.4 are affected; 0.6.5 patches it.
- Affected
- pyasn1 (pip): <= 0.6.4
- Fixed
- pyasn1 (pip): 0.6.5
The repeated concatenation occurs in constructed OCTET STRING decoding and the character-string decoders that inherit it, plus indefinite-length ANY when an ANY schema is selected. Each new fragment copies an increasingly large prefix, so N fixed-size fragments cost roughly O(N squared). DER rejects constructed OCTET STRING by default but accepts its definite-length form with asn1Spec set to univ.OctetString, and accepts constructed character strings such as UTF8String without a schema.
The advisory claims availability loss from CPU exhaustion only, with no demonstrated confidentiality or integrity impact, and notes that reachability before authentication or through a particular protocol depends on the application. Users should upgrade to pyasn1 0.6.5 or enforce untrusted ASN.1 input-size limits and decoder-worker CPU caps before upgrading.
Researchers measured the issue on the v0.6.4 tag, but absolute CPU times vary by machine and runtime; fragment-count scaling is the relevant observation rather than fixed performance guarantees.
Sources & technical scope 3 sources
GitHub Advisory Database — original source ↗
GitHub_M CNA / CVE Program — original source ↗
GitHub_M CNA / CVE Program — original source ↗
Affected: pyasn1 (pip): <= 0.6.4
Fixed: pyasn1 (pip): 0.6.5
Exploitation: Not established by supplied evidence
Scope & limitations: Reachability before authentication or through a particular protocol depends on the application; absolute CPU times are environment-dependent and are not fixed performance guarantees. This issue is distinct from CVE-2026-59885's OID accumulation problem fixed in pyasn1 0.6.4.
External findings belong to the credited researchers.