Summary
Netty: RedisArrayAggregator max-elements failure leaves retained partial aggregate state
RedisArrayAggregator clears retained partial aggregate state when the maxNestedArrayDepth limit is exceeded, but it does not clear the same state when the sibling maxElements limit is exceeded. A peer can start a valid RESP array, send a bulk-string child, then send a nested array header longer than the configured maxElements. Netty throws a decoder exception, but the existing partial aggregate remains retained in the handler.
If the application leaves the channel alive after the exception, later messages are still consumed into the pre-error aggregate. The supplied PoV proves both the retained ByteBuf reference and the stale parser state continuation.
Technical Details
RedisArrayAggregator.decode(...) retains non-array messages before adding them to depths.peek().children. In decodeRedisArrayHeader(...), the header.length() > maxElements branch throws immediately:
if (header.length() > maxElements) {
throw new CodecException("this codec doesn't support longer length than " + maxElements);
}
The immediately following nested-depth branch clears retained aggregate state before throwing:
if (depths.size() >= maxNestedArrayDepth) {
releaseAndClearDepths();
throw new CodecException("max nested array depth exceeded: " + maxNestedArrayDepth);
}
The missing cleanup in the first branch leaves retained children and aggregate state reachable after the exception.
PoC
Place the supplied RedisArrayAggregatorIncompleteCleanupPovTest.java under:
codec-redis/src/test/java/io/netty/handler/codec/redis/
Run:
./mvnw -pl codec-redis -am -Dtest=RedisArrayAggregatorIncompleteCleanupPovTest -Dsurefire.failIfNoSpecifiedTests=false -DskipNativeTests -DskipAutobahnTests test
The test suite includes:
- serialized RESP trigger through
RedisDecoder,RedisBulkStringAggregator, andRedisArrayAggregator; - direct refcount proof that max-elements overflow does not release the retained child immediately;
- post-exception continuation proof that the stale aggregate consumes a later message;
- nested-depth controls that clear the same partial aggregate state.
All five tests pass on current 4.2, 4.2.15.Final, and 4.1.135.Final.
Affected Package/Versions
io.netty:netty-codec-redis
Confirmed on:
- current
4.2branch head7bae566a93e69409697fe57fa807910ba5c9720e 4.2.15.Finalata41f7b289ce14.1.135.Finalatf05f765d8146
Advisory History
This differs from the public Redis codec advisories because it reproduces on their patched tags:
GHSA-5w86-c3rq-vjj7GHSA-3244-j874-rhc2/CVE-2026-44250GHSA-6jv9-x5w9-2ccm/CVE-2026-48006GHSA-6ghj-frrj-jjj3/CVE-2026-44890
Why This Is Not Intended Behavior
The public API docs document RedisArrayAggregator as aggregating RedisMessage parts into ArrayRedisMessage and document a CodecException when an array header exceeds maxElements. They do not document preserving pre-exception partial aggregate state after that limit fires.
The adjacent nested-depth branch already calls releaseAndClearDepths() before throwing. The max-elements branch is the sibling aggregation-limit branch but throws without cleanup. Netty's later Redis lifecycle cleanup patch explicitly added release behavior for nested-array failure and handler removal, leaving the max-elements failure branch as a missed cleanup path.
Impact
For Redis codec pipelines that continue after codec exceptions, an unauthenticated peer can keep attacker-controlled aggregate state alive across a security-limit exception. This can pin retained pooled buffers until channel close/removal or until a later message completes the stale aggregate.
RedisBulkStringAggregator permits bulk strings up to RedisConstants.REDIS_MESSAGE_MAX_LENGTH (512MB), so the retained child can be large in deployments that aggregate untrusted Redis streams.
Applications that always close the channel or remove the handler on decoder exceptions will trigger existing cleanup; the issue is the missing immediate cleanup on the max-elements failure path while the handler remains installed.
CVE-2026-56818 has a CVSS score of 6.5 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.1.136.Final, 4.2.16.Final); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Call releaseAndClearDepths() before throwing from the max-elements branch. Consider applying the same cleanup to all unrecoverable decodeRedisArrayHeader(...) error exits that can occur while depths is non-empty.
Frequently Asked Questions
- What is CVE-2026-56818? CVE-2026-56818 is a medium-severity security vulnerability in io.netty:netty-codec-redis (maven), affecting versions < 4.1.136.Final. It is fixed in 4.1.136.Final, 4.2.16.Final.
- How severe is CVE-2026-56818? CVE-2026-56818 has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of io.netty:netty-codec-redis are affected by CVE-2026-56818? io.netty:netty-codec-redis (maven) versions < 4.1.136.Final is affected.
- Is there a fix for CVE-2026-56818? Yes. CVE-2026-56818 is fixed in 4.1.136.Final, 4.2.16.Final. Upgrade to this version or later.
- Is CVE-2026-56818 exploitable, and should I be worried? Whether CVE-2026-56818 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-56818 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-56818?
- Upgrade
io.netty:netty-codec-redisto 4.1.136.Final or later - Upgrade
io.netty:netty-codec-redisto 4.2.16.Final or later
- Upgrade