CVE-2026-106450
yawkat LZ4 Java: LZ4FrameInputStream reallocates block buffers for every frame, allowing CPU and GC amplification from small inputs
Description
Summary
LZ4FrameInputStream allocates two new buffers of the frame's maximum block size, up to 4 MiB each, every time it reads a frame header. Because concatenated frames are read by default, an input made of many minimal empty frames forces about 8 MiB of zeroed heap allocation for every 11 input bytes.
Details
In net.jpountz.lz4.LZ4FrameInputStream.readHeader():
maxBlockSize = frameInfo.getBD().getBlockMaximumSize();
compressedBuffer = new byte[maxBlockSize]; // Reused during different compressions
rawBuffer = new byte[maxBlockSize];
buffer = ByteBuffer.wrap(rawBuffer);
This runs for every frame, and the previous frame's arrays are never reused. A valid 11-byte frame consists of the magic number, FLG 0x60, BD 0x70 (4 MiB blocks), the header checksum, and an immediate end mark. It carries no data, yet triggers the full 8 MiB allocation. new LZ4FrameInputStream(in) reads concatenated frames by default.
In local measurements on JDK 25, 10,000 such frames (110 KB of input) took about 8 seconds of CPU to read, roughly 70 seconds per MiB of input. This was similar under G1, Parallel, Serial and ZGC. A legitimate stream costs orders of magnitude less per input byte.
Impact
Applications that decode attacker-controlled LZ4 frame data with LZ4FrameInputStream can be made to spend large amounts of CPU and GC time relative to the input size. Live heap stays bounded at about 8 MiB and the stream produces no output, so decompressed-size limits do not help. Cost grows linearly with input size, so the practical limit is the compressed input size the application accepts. Availability impact only.
Applications using readSingleFrame = true perform only one allocation and are not affected.
Patch
Fixed in lz4-java 1.11.4. LZ4FrameInputStream now allocates its block buffers only when a block needs them and reuses them across frames, never shrinking them. The content checksum hash and the skippable-frame skip buffer are also reused instead of being created for every frame. Decompression is limited to the current frame's maximum block size.
For older versions, the workaround is to limit the compressed input size accepted from untrusted sources, or use single-frame mode where that is sufficient.
Affected Maven artifacts (2)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| at.yawk.lz4 » lz4-java | < 1.11.4 | 1.11.4 |
| org.lz4 » lz4-java | <= 1.8.1 | - |
Blast radius
78% of the dependent artifacts (15,136) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 43,610 |
| 2 hops | 408,044 |
| 3 hops | 308,662 |
| 4 hops | 195,065 |
| 5 hops | 74,099 |
| 6 hops | 22,252 |
Most used dependents
- org.apache.hadoop » hadoop-common3,482 usages
- org.apache.spark » spark-sql3,174 usages
- org.apache.kafka » kafka-clients3,135 usages
- org.apache.spark » spark-core2,899 usages
- org.codehaus.mojo » buildnumber-maven-plugin2,777 usages
- com.typesafe.play » play-test1,902 usages
- org.apache.hadoop » hadoop-client1,796 usages
- org.apache.kafka » kafka1,450 usages
- com.typesafe.play » play-server1,436 usages
- com.typesafe.play » play-logback1,380 usages
- org.elasticsearch » elasticsearch1,377 usages
- org.apache.hadoop » hadoop-mapreduce-client-core1,366 usages
- org.scalatestplus.play » scalatestplus-play1,286 usages
- com.jetbrains.intellij.platform » core1,284 usages
- com.typesafe.play » play-akka-http-server1,152 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
References
- Webhttps://github.com/yawkat/lz4-java/security/advisories/GHSA-gm45-99xc-r7wv
- Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-106450
- Webhttps://github.com/yawkat/lz4-java/commit/2acc0ec1ead226145c62a817c18c8ed49233a283
- Packagehttps://github.com/yawkat/lz4-java
- Webhttps://github.com/yawkat/lz4-java/releases/tag/v1.11.4
