Oct 1, 2026·6 min read·31 visits
Tornado's CurlAsyncHTTPClient lacks size limits and backpressure during decompression, allowing a remote server to trigger process termination via memory exhaustion using a decompression bomb.
A critical uncontrolled resource consumption vulnerability exists in the Tornado web server's libcurl-based HTTP client (CurlAsyncHTTPClient). When processing highly compressed responses with response decompression enabled, the client experiences unbounded memory growth. This leads to host memory exhaustion and denial of service via application crashes.
Tornado is an asynchronous networking library for Python that provides high-performance HTTP client implementations. The library features two distinct client classes: SimpleAsyncHTTPClient, written in pure Python, and CurlAsyncHTTPClient, which wraps the libcurl engine using pycurl bindings. The default configuration of these clients enables automatic decompression of response bodies when they are compressed using gzip or deflate transfer encodings.
While SimpleAsyncHTTPClient historically integrated safety parameters to limit unbounded memory consumption during response parsing, CurlAsyncHTTPClient was implemented without equivalent constraints. This architectural omission exposes systems to uncontrolled resource consumption vulnerabilities when interacting with untrusted upstream servers. Specifically, the client fails to restrict the volume of decompressed data processed in memory.
An upstream attacker can exploit this weakness by serving a highly compressed response, commonly known as a decompression bomb or zip bomb. Because the library performs decompression transparently in its event loop, the system memory is exhausted, causing an Out-of-Memory (OOM) event that terminates the application process. This vulnerability is cataloged as GHSA-CHX6-46F5-W4VP and represents a high-severity denial-of-service vector.
The primary flaw resides in the handling of response bodies within CurlAsyncHTTPClient. When HTTP response decompression is active (decompress_response=True), libcurl automatically manages the decoding of compressed transfer-codings. As the network buffer is filled, libcurl continuously triggers the registered write callback function (pycurl.WRITEFUNCTION) to forward the decoded data to Python.
In buffered mode (where no streaming_callback is defined), Tornado historically stored incoming response bytes directly in an unbounded io.BytesIO buffer. Because BytesIO expands dynamically without enforcing capacity limits, libcurl could stream gigabytes of uncompressed data into Python's heap. The engine had no mechanism to detect that the decompressed payload exceeded acceptable limits, as the wire-level compressed size remained extremely small.
In streaming mode (where a streaming_callback is provided), a different resource exhaustion vector occurs. The callback registered with pycurl immediately enqueued each decompressed chunk to the Tornado IOLoop event queue using IOLoop.add_callback(). Because libcurl processes the socket stream synchronously inside curl_multi_socket_action, it enqueues raw byte chunks much faster than the single-threaded event loop can schedule and execute the application-level callbacks, resulting in a rapid accumulation of memory objects.
The vulnerability is clearly demonstrated by inspecting the original implementation of the writing routines inside tornado/curl_httpclient.py. In older versions, when a streaming callback was configured, the write function registered with pycurl was bound to io_loop.add_callback without any backpressure checks or queue size evaluations.
# Vulnerable configuration in older versions
write_function = buffer.write
curl.setopt(pycurl.WRITEFUNCTION, write_function)The patch introduced in version 6.5.9 mitigates these vectors by enforcing size limits in both buffered and streaming execution paths. In buffered mode, the write function now checks the current buffer offset plus the new chunk length against self.max_body_size (defaulting to 100MB). If this threshold is exceeded, the function returns zero, which explicitly forces libcurl to abort the transfer with a CURLE_WRITE_ERROR exception.
# Patched Buffered Write Function
def write_function(chunk: bytes) -> int:
if buffer.tell() + len(chunk) > self.max_body_size:
curl.info["body_too_large"] = True
# Returning zero forces libcurl to abort with CURLE_WRITE_ERROR
return 0
return buffer.write(chunk)For streaming mode, Tornado introduced _CurlStreamingBuffer to act as an intermediate queue with backpressure capability. When the size of the queued chunks waiting to be delivered to the application exceeds 1MB (max_buffer_size), the class pauses the transfer by returning pycurl.WRITEFUNC_PAUSE. This instructs libcurl to halt reading from the underlying network socket until the IOLoop drains the existing chunks and invokes curl.pause(pycurl.PAUSE_CONT).
# Patched Streaming Buffer Logic
class _CurlStreamingBuffer:
max_buffer_size = 1024 * 1024 # 1MB high-water mark
def write(self, chunk: bytes) -> int:
if self.total + len(chunk) > self.client.max_body_size:
self.body_too_large = True
return 0 # Abort transfer
if self.size >= self.max_buffer_size:
self.paused = True
return pycurl.WRITEFUNC_PAUSE # Pause libcurl processing
self.chunks.append(chunk)
self.size += len(chunk)
self.total += len(chunk)
self._schedule_flush()
return len(chunk)Exploiting GHSA-CHX6-46F5-W4VP requires an attacker to control or influence the destination URL requested by the target's CurlAsyncHTTPClient. This is highly relevant in systems performing automated web scraping, content fetching, or webhook delivery. Once the client initiates a request to the malicious URL, the attacker's server responds with highly compressed data.
The server responds with standard HTTP headers indicating compression, such as Content-Encoding: gzip or Content-Encoding: deflate. The response payload contains a decompression bomb constructed using recursive compression techniques. For example, a file containing 4GB of null bytes can be compressed to approximately 1MB or less, which easily bypasses wire-level size checks or timeout limits.
As libcurl decompresses the data, the memory footprint of the Tornado application expands exponentially. If the application is operating in buffered mode, the process heap memory is depleted within seconds, triggering the operating system's Out-Of-Memory (OOM) killer. If the application is operating in streaming mode, the callback queue inflates to hundreds of megabytes before the callbacks can be scheduled, culminating in an identical process termination.
The primary impact of this vulnerability is a complete Denial of Service (DoS) of the affected application. Because Tornado is commonly used to build API gateways, web crawlers, and asynchronous microservices, the termination of the main application process halts all concurrent operations. This results in service disruption for all users relying on the affected node.
While the vulnerability resides on the client side, it represents a substantial threat because client applications routinely connect to dynamic, user-supplied, or third-party endpoints. In environments where the client is automated, an attacker can trigger crashes repeatedly, preventing recovery and maintaining a persistent denial of service. The vulnerability does not require any authentication to exploit.
Although this flaw leads primarily to resource exhaustion, it does not allow for direct Remote Code Execution (RCE) or Information Disclosure. However, the resulting instability can be leveraged in chained attacks to bypass monitoring tools, force failovers to less secure nodes, or disrupt critical synchronization services across distributed systems.
The most effective remediation is upgrading the tornado package to versions 6.5.9 (if using the 6.5.x release branch) or 6.6.0 (if upgrading to the next major version branch). These releases introduce the max_body_size enforcement and the backpressure buffering logic for CurlAsyncHTTPClient, establishing a predictable memory ceiling of 100MB plus the 1MB streaming high-water mark.
In scenarios where immediate package upgrades are unfeasible, administrators can mitigate the risk by modifying their application configuration. Developers can explicitly switch the HTTP client backend from CurlAsyncHTTPClient to the pure-Python SimpleAsyncHTTPClient. The pure-Python implementation inherently respects the max_body_size limitation, protecting the host from unbounded decompression attacks.
Alternatively, developers can disable automatic response decompression by setting the decompress_response property to False in their HTTPRequest configurations. While this prevents transparent decompression-based memory exhaustion, any subsequent manual decompression of user-supplied payloads must be implemented with strict input length checks to prevent similar resource exhaustion conditions.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
Tornado Tornado | < 6.5.9 | 6.5.9 |
Tornado Tornado | == 6.6.0.dev1 | 6.6.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-409, CWE-400 |
| Attack Vector | Network (Unauthenticated Upstream Server) |
| CVSS v3.1 | 7.5 (High) |
| Exploit Status | Proof of Concept (PoC) available |
| Impact | Denial of Service (OOM Crash) |
| Affected Component | tornado.curl_httpclient.CurlAsyncHTTPClient |
The product decompresses highly compressed data without validating that the decompressed size is safe, leading to resource exhaustion.
File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.