CVE-2026-106452
yawkat LZ4 Java: LZ4BlockInputStream allocates an unvalidated compressed length from the stream header
Description
Summary
LZ4BlockInputStream grows its compressed-input buffer to the attacker-controlled compressedLen value from the legacy LZ4Block stream header before reading any payload bytes. A header-only input can therefore trigger a near-2 GiB allocation and exhaust the JVM heap.
Details
In net.jpountz.lz4.LZ4BlockInputStream, refill() validates that compressedLen is nonnegative but does not cap it before allocation:
case COMPRESSION_METHOD_LZ4:
if (compressedBuffer.length < compressedLen) {
compressedBuffer = new byte[Math.max(compressedLen, compressedBuffer.length * 3 / 2)];
}
readFully(compressedBuffer, compressedLen);
The paired LZ4BlockOutputStream never emits such a block. If compression is not smaller than the original block, it writes the block as RAW:
if (compressedLength >= o) {
compressMethod = COMPRESSION_METHOD_RAW;
compressedLength = o;
} else {
compressMethod = COMPRESSION_METHOD_LZ4;
}
Existing readers generally accept noncanonical LZ4-method blocks where compressedLen >= originalLen, but no canonical writer found produces them.
Impact
Applications that pass attacker-controlled legacy LZ4Block streams to LZ4BlockInputStream can suffer heap exhaustion from a header-only input. The impact is availability-only and requires no valid compressed payload.
Patch
As of lz4-java 1.11.2, lz4-java rejects lz4 blocks where the compressed length is larger than uncompressed. Readers would generally emit these as raw blocks instead. You can use the new acceptOversizedBlocks flag to restore the old behavior, but this reintroduces the DoS vector.
Affected Maven artifacts (2)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| at.yawk.lz4 » lz4-java | < 1.11.2 | 1.11.2 |
| org.lz4 » lz4-java | <= 1.8.1 | - |
Blast radius
71% of the dependent artifacts (13,655) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 43,185 |
| 2 hops | 404,384 |
| 3 hops | 307,756 |
| 4 hops | 194,756 |
| 5 hops | 73,931 |
| 6 hops | 22,098 |
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-4v53-57pg-c464
- Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-106452
- Webhttps://github.com/yawkat/lz4-java/commit/bb83dd16163cdb71231af06b0a5651881148a634
- Packagehttps://github.com/yawkat/lz4-java
- Webhttps://github.com/yawkat/lz4-java/releases/tag/v1.11.2
