VAITP Dataset

← Back to the dataset

CVE-2026-48586

A data amplification vulnerability in Apache Thrift may lead to Denial of Service.

  • CVSS 8.7
  • 409
  • Resource Management
  • Remote

Improper Handling of Highly Compressed Data (Data Amplification) vulnerability in Apache Thrift C++, Java, Python, Go, D, C/GLib bindings. This issue affects Apache Thrift: before 0.24.0. Users are recommended to upgrade to version 0.24.0, which fixes the issue.

CWE
409
CVSS base score
8.7
Published
2026-07-27
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Apache Thrif
Fixed by upgrading
Yes

Solution

Upgrade Apache Thrift to version 0.24.0.

Vulnerable code sample

import zlib
import struct
from io import BytesIO

from thrift.transport.TTransport import TTransportBase, TTransportException


class TZlibTransport(TTransportBase):
    """Transport that wraps another, compressing/decompressing with zlib."""

    def __init__(self, trans):
        self._trans = trans
        self._rbuf = BytesIO()

    def _read_frame(self):
        """Reads a single zlib-compressed frame from the underlying transport."""
        header = self._trans.readAll(4)
        (sz,) = struct.unpack("!i", header)
        if sz < 0:
            raise TTransportException(TTransportException.NEGATIVE_SIZE)
        
        compressed = self._trans.readAll(sz)

        # VULNERABLE: A small compressed payload can decompress to a huge size,
        # exhausting memory and causing a Denial of Service (DoS).
        uncompressed = zlib.decompress(compressed)

        self._rbuf = BytesIO(uncompressed)

    # other methods omitted for brevity

Patched code sample

import zlib
import struct
from io import BytesIO

from thrift.transport.TTransport import TTransportBase, TTransportException

MAX_UNCOMPRESSED_DATA_SIZE = 100 * 1024 * 1024  # 100MB


class TZlibTransport(TTransportBase):
    """Transport that wraps another, compressing/decompressing with zlib."""

    def __init__(self, trans):
        self._trans = trans
        self._rbuf = BytesIO()

    def _read_frame(self):
        """Reads a single zlib-compressed frame from the underlying transport."""
        header = self._trans.readAll(4)
        (sz,) = struct.unpack("!i", header)
        if sz < 0:
            raise TTransportException(TTransportException.NEGATIVE_SIZE)

        compressed = self._trans.readAll(sz)

        # FIX: Enforce a maximum size on decompressed data using max_length to
        # prevent a decompression bomb from exhausting system memory.
        try:
            decompressor = zlib.decompressobj()
            uncompressed = decompressor.decompress(compressed, MAX_UNCOMPRESSED_DATA_SIZE)
            if decompressor.unconsumed_tail or decompressor.flush():
                raise zlib.error("Compressed data exceeds size limit")
        except zlib.error as e:
            raise TTransportException(TTransportException.SIZE_LIMIT, f"Decompression error: {e}")

        self._rbuf = BytesIO(uncompressed)

    # other methods omitted for brevity

Cite this entry

@misc{vaitp:cve202648586,
  title        = {{A data amplification vulnerability in Apache Thrift may lead to Denial of Service.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-48586},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-48586/}}
}
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 ::