Aug 7, 2026·5 min read·70 visits
Netty's Redis array aggregator fails to release pooled direct buffers upon specific limit-validation errors, allowing remote attackers to pin system memory and induce a Denial of Service.
A vulnerability in Netty's Redis codec allows remote unauthenticated attackers to cause a memory-pinning Denial of Service (DoS) due to the failure to release partial aggregate state when specific error conditions occur in RedisArrayAggregator. When processing Redis Serialization Protocol (RESP) messages, the aggregator fails to clear internal queues and release retained direct byte buffers on exception paths triggered by exceeded maxElements or invalid length properties. If the pipeline does not explicitly tear down the connection upon detecting a decoder error, subsequent elements continue utilizing the stale context, allowing memory blocks to remain indefinitely pinned.
Netty's Redis codec offers high-performance parsing and aggregation for the Redis Serialization Protocol (RESP). The RedisArrayAggregator component converts incoming sequential RESP elements (such as bulk strings or integers) into structured, composite array structures represented by ArrayRedisMessage objects.
To manage hierarchy and nested structures, the aggregator tracks incoming components using an internal stack of aggregate states. To prevent excessive memory allocation by untrusted peers, the handler enforces configured security limits, specifically bounding both the maximum element count (maxElements) and the maximum nesting depth (maxNestedArrayDepth).
A critical vulnerability exists where the handler validation logic deviates across different threshold checks. When specific constraints are violated, the aggregator raises decoder exceptions without releasing the already gathered partial states or decrementing the reference count of associated pooled buffers. This behavior leaves allocated resources active on the handler context, introducing a remote resource-pinning vector.
The root cause is located in the RedisArrayAggregator.decodeRedisArrayHeader method during the assessment of incoming array length fields. The handler uses an internal stack named depths containing AggregateState instances that retain reference counts of previously accumulated child payloads.
Under normal execution, if the incoming array structure exceeds the maximum allowed nesting limit (depths.size() >= maxNestedArrayDepth), the code executes releaseAndClearDepths(), which releases all retained direct buffers, and then raises a CodecException.
However, if the incoming header specifies an array length that exceeds the maxElements boundary, or if a negative length (bad length) check is triggered, the system directly instantiates and throws a CodecException without invoking releaseAndClearDepths(). This oversight allows references to accumulated buffers to remain pinned in JVM memory, as the internal stack is never systematically cleared on these exception paths.
The original implementation checked limits in sequence but failed to clear the accumulation stack on every path that raised an error.
// Vulnerable logic in RedisArrayAggregator.java
private RedisMessage decodeRedisArrayHeader(ArrayHeaderRedisMessage header) {
if (header.isNull()) {
return ArrayRedisMessage.NULL_INSTANCE;
} else if (header.length() > 0L) {
if (header.length() > maxElements) {
// State is not cleared before throwing this exception
throw new CodecException("this codec doesn't support longer length than " + maxElements);
}
if (depths.size() >= maxNestedArrayDepth) {
releaseAndClearDepths(); // Only cleared here
throw new CodecException("max nested array depth exceeded: " + maxNestedArrayDepth);
}
depths.push(new AggregateState((int) header.length()));
return null;
} else {
// State is not cleared before throwing this exception
throw new CodecException("bad length: " + header.length());
}
}The remediation introduces a centralized helper method, clearAndCreateException, to ensure that state cleanup is applied consistently across all validation pathways:
// Remediation logic in RedisArrayAggregator.java
private CodecException clearAndCreateException(String msg) {
releaseAndClearDepths(); // Explicitly releases all pooled memory and clears the depths stack
return new CodecException(msg);
}
private RedisMessage decodeRedisArrayHeader(ArrayHeaderRedisMessage header) {
if (header.isNull()) {
return ArrayRedisMessage.NULL_INSTANCE;
} else if (header.length() > 0L) {
if (header.length() > maxElements) {
throw clearAndCreateException("this codec doesn't support longer length than " + maxElements);
}
if (depths.size() >= maxNestedArrayDepth) {
throw clearAndCreateException("max nested array depth exceeded: " + maxNestedArrayDepth);
}
depths.push(new AggregateState((int) header.length()));
return null;
} else {
throw clearAndCreateException("bad length: " + header.length());
}
}An unauthenticated attacker can exploit this state retention vulnerability through a multi-step sequence over an established TCP connection.
First, the attacker initiates a valid array sequence to trigger memory allocation on the server side, sending a small header and a large bulk string. The aggregator allocates a pooled direct buffer and pushes the state to the stack.
Second, the attacker sends a subsequent array header with a length value intentionally exceeding the configured maxElements limit. This triggers a validation failure on the server.
Third, because the state cleanup is bypassed, the server leaves the allocated direct buffer pinned in memory. The attacker keeps the socket connection open and repeats this sequence, forcing the server to exhaust its pooled direct memory space.
The consequence of this vulnerability is a denial of service (DoS) caused by persistent JVM memory exhaustion. Because high-performance Netty servers utilize a pooled memory model (such as PooledByteBufAllocator), unreleased direct buffers do not return to the system and cannot be reclaimed by standard garbage collection.
The retention of these buffers is tied directly to the lifetime of the channel handler context. If the application continues processing traffic on the same TCP channel or catches decoder exceptions without tearing down the connection, memory remains pinned.
By repeatedly inducing this error state across multiple sessions, an attacker can consume all available direct or heap memory allocations. This forces the system to throw an OutOfMemoryError on subsequent requests, causing the Netty worker threads to terminate or crash the application.
The primary defense is updating the Netty dependency to a secure version. The patch has been backported and released in versions 4.1.136.Final and 4.2.16.Final.
If immediate library upgrades are not feasible, implement a strict connection-teardown routine in the pipeline. Ensure that your Netty pipeline handler explicitly catches CodecException and closes the associated channel to free up handler resources.
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause instanceof CodecException) {
// Force connection termination to release any pinned aggregate states
ctx.close();
} else {
ctx.fireExceptionCaught(cause);
}
}Additionally, monitor application performance telemetry. Look for continuous linear growth in direct memory pools alongside unhandled exception logs referencing Redis decoder limit failures.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
Netty Netty | < 4.1.136.Final | 4.1.136.Final |
Netty Netty | >= 4.2.0-Final, < 4.2.16.Final | 4.2.16.Final |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-401, CWE-703 |
| Attack Vector | Network (AV:N) |
| CVSS Base Score | 6.5 |
| Impact Type | Denial of Service (Memory Exhaustion) |
| Exploit Status | No public PoC available |
| CISA KEV Status | Not Listed |
The application does not release memory after its effective lifetime, or fails to properly handle exceptional conditions, leading to resource exhaustion.
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.