VAITP Dataset

← Back to the dataset

CVE-2026-41608

Data amplification vulnerability in Apache Thrift Python may lead to DoS.

  • CVSS 7.5
  • 409
  • Resource Management
  • Remote

Improper Handling of Highly Compressed Data (Data Amplification) vulnerability in Apache Thrift Python 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
7.5
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 to Apache Thrift version 0.24.0 or later.

Vulnerable code sample

import zlib
import io

try:
    from thrift.transport.TTransport import TTransportException
except ImportError:
    # Mock exception if thrift is not installed
    class TTransportException(Exception):
        INVALID_DATA = 2
        def __init__(self, type=None, message=None):
            super().__init__(message)

def read_zlib_frame(transport: io.BytesIO):
    """
    Reads a compressed frame from the transport and returns the decompressed data.
    This function is analogous to a method in TZlibTransport.
    """
    # In a real scenario, a frame length would be read first.
    # This is simplified to focus on the decompression call.
    compressed_frame = transport.read()
    if not compressed_frame:
        return b""

    try:
        # VULNERABLE: The zlib.decompress function is called without any limit on the
        # output size, allowing a small, highly-compressed input ("zip bomb")
        # to expand into a huge amount of data, causing a denial of service.
        uncompressed_data = zlib.decompress(compressed_frame)
        return uncompressed_data
    except zlib.error as e:
        raise TTransportException(
            type=TTransportException.INVALID_DATA,
            message=f"Could not decompress data: {e}",
        )

Patched code sample

import zlib
import io

try:
    from thrift.transport.TTransport import TTransportException
except ImportError:
    # Mock exception if thrift is not installed
    class TTransportException(Exception):
        INVALID_DATA = 2
        def __init__(self, type=None, message=None):
            super().__init__(message)

# The fix introduces a configurable limit on the uncompressed data size.
MAX_UNCOMPRESSED_SIZE_BYTES = 100 * 1024 * 1024  # 100 MB

def read_zlib_frame(transport: io.BytesIO):
    """
    Reads a compressed frame from the transport and returns the decompressed data.
    This function is analogous to a method in TZlibTransport.
    """
    # In a real scenario, a frame length would be read first.
    # This is simplified to focus on the decompression call.
    compressed_frame = transport.read()
    if not compressed_frame:
        return b""

    try:
        # FIX: The 'bufsize' parameter limits the size of the output buffer.
        # If the decompressed data would exceed this, zlib.error is raised,
        # preventing excessive memory allocation (zip bomb).
        uncompressed_data = zlib.decompress(
            compressed_frame, bufsize=MAX_UNCOMPRESSED_SIZE_BYTES
        )
        return uncompressed_data
    except zlib.error as e:
        raise TTransportException(
            type=TTransportException.INVALID_DATA,
            message=f"Could not decompress data: {e}",
        )

Cite this entry

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