VAITP Dataset

← Back to the dataset

CVE-2026-59980

Unbounded integer decoding in hpack causes O(n²) runtime, leading to DoS.

  • CVSS 6.3
  • CWE-400
  • Resource Management
  • Remote

hpack is an HTTP/2 Header Encoding for Python. Prior to version 4.2.0, unbounded variable integer decoding can cause run-away computation on malformed input leading to O(n^2) runtime, effectively blocking further processing with large enough unsanitized input. A fix is available in python-hyper/hpack v4.2.0 to restricted variable integer decoding to uint32 to prevent run-away computation. As a workaround, sanitize input to hpack decoder for long sequences of `0xFF` values to prevent malicious use.

CVSS base score
6.3
Published
2026-09-23
OWASP
A04 Insecure Design
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
hpack
Fixed by upgrading
Yes

Solution

Upgrade python‑hyper/hpack to version 4.2.0 (or later).

Vulnerable code sample

from hpack import Decoder

def decode_varint(data: bytes) -> int:
    # VULNERABLE: unbounded variable‑integer decoding permits O(n²) work on long 0xFF sequences
    i = 0
    shift = 0
    result = 0
    while True:
        b = data[i]
        i += 1
        result |= (b & 0x7f) << shift
        if (b & 0x80) == 0:
            break
        shift += 7
    return result

def process_header_block(block: bytes) -> dict:
    decoder = Decoder()
    # feed raw block to the decoder; the decoder eventually calls decode_varint
    return decoder.decode(block)

Patched code sample

from hpack import Decoder

def decode_varint(data: bytes) -> int:
    # FIX: limit variable‑integer size to 32 bits to avoid runaway computation
    i = 0
    shift = 0
    result = 0
    while True:
        b = data[i]
        i += 1
        result |= (b & 0x7f) << shift
        if (b & 0x80) == 0:
            break
        shift += 7
        if shift >= 32:          # enforce uint32 bound
            raise ValueError("Variable integer exceeds 32‑bit limit")
    return result

def process_header_block(block: bytes) -> dict:
    decoder = Decoder()
    return decoder.decode(block)

Published 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.

Cite this entry

@misc{vaitp:cve202659980,
  title        = {{Unbounded integer decoding in hpack causes O(n²) runtime, leading to DoS.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-59980},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-59980/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.