CVE-2026-106452: yawkat LZ4 Java: LZ4BlockInputStream allocates an unvalidated compressed length from the stream header
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:
java case COMPRESSIONMETHODLZ4: 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:
java if (compressedLength >= o) { compressMethod = COMPRESSIONMETHODRAW; compressedLength = o; } else { compressMethod = COMPRESSIONMETHODLZ4; }
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.
Other sources
yawkat LZ4 Java provides LZ4 compression for Java. Prior to 1.11.2, net.jpountz.lz4.LZ4BlockInputStream refill() validates that the compressedLen field in a legacy LZ4Block header is nonnegative but allocates a compressed-input buffer of that attacker-controlled size before reading payload data, allowing a header-only stream to request a near-2 GiB allocation and exhaust the JVM heap. Canonical writers emit raw blocks when compression is not smaller than the original block, but vulnerable readers accept non-canonical oversized compressed blocks. This issue is fixed in version 1.11.2.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
maven/at.yawk.lz4:lz4-javato a version that resolves this vulnerability.Fixed in 1.11.2 - Upgrade
Upgrade
lz4-javato a version that resolves this vulnerability.Fixed in 1.11.2
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using yawkat LZ4 Java before version 1.11.2 are exposed when they pass attacker-controlled or otherwise untrusted LZ4 legacy block streams to net.jpountz.lz4.LZ4BlockInputStream.
What does an attacker need to do to trigger the problem?
An attacker only needs to provide a crafted stream header with a very large nonnegative compressedLen value. The stream can be header-only; no payload data is required before the vulnerable reader attempts the allocation.
Is this limited to streams produced by standard LZ4 writers?
No. Canonical writers emit raw blocks when compression would not reduce the block size, but vulnerable readers accept non-canonical oversized compressed blocks. Exploitation relies on such an oversized crafted block rather than normal canonical output.
What is the impact of successful exploitation?
The vulnerable reader can attempt to allocate a compressed-input buffer approaching 2 GiB, which can exhaust the JVM heap and cause a denial of service. The provided severity vector indicates no confidentiality or integrity impact.
What should be done to remediate the issue?
Upgrade yawkat LZ4 Java to version 1.11.2, which fixes the issue. Until upgrading, avoid processing untrusted LZ4 legacy block streams with the affected reader.