at.yawk.lz4:lz4-java: yawkat LZ4 Java: LZ4DecompressorWithLength allocates the unvalidated size from the 4-byte length header, so a 5-byte input triggers a 1 GiB allocation and OutOfMemoryError
What fixes it
- 1.11.2at.yawk.lz4:lz4-java, mavenGitHub
<dependency><groupId>at.yawk.lz4</groupId><artifactId>lz4-java</artifactId><version>1.11.2</version></dependency> - 1.11.2at.yawk.lz4:lz4-java, MavenOSV
<dependency><groupId>at.yawk.lz4</groupId><artifactId>lz4-java</artifactId><version>1.11.2</version></dependency>
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Summary
LZ4DecompressorWithLength.decompress(byte[], int) allocates whatever size the 4-byte length header declares, before it reads a single byte of compressed data. A 5-byte input whose header says 0x40000000 makes the JVM commit a gigabyte and can cause heap exhaustion.
Details
net.jpountz.lz4.LZ4DecompressorWithLength reads the header and passes it straight on:
final int destLen = getDecompressedLength(src, srcOff); return fastDecompressor.decompress(src, srcOff + 4, destLen);
and net.jpountz.lz4.LZ4FastDecompressor allocates it:
public final byte[] decompress(byte[] src, int srcOff, int destLen) {
final byte[] decompressed = new byte[destLen];
decompress(src, srcOff, decompressed, 0, destLen);
return decompressed;
}getDecompressedLength performs no validation: no comparison against src.length, no ceiling, no rejection of negatives. LZ4SafeDecompressor.decompress(byte[], int, int, int) has the same shape with maxDestLen.
The sibling overload that callers pass their own buffer to, decompress(src, srcOff, dest, destOff, destLen), is fine, because there destLen is chosen by the caller rather than by the input. The bug is specific to the convenience overloads that take the size from the header, and that difference is the whole finding.
Impact
Any application that decompresses attacker-supplied LZ4 frames through the with-length convenience API can be made to allocate up to 2 GiB per call from a 5-byte message. On a service that decompresses request bodies, a few concurrent 5-byte requests exhaust the heap. No privileges are needed, only the ability to get bytes into the decompressor. Confidentiality and integrity are untouched.
Text from GitHub Advisory Database
Affected versions 24
- at.yawk.lz4:lz4-java, maven<= 1.11.1GitHub
- org.lz4:lz4-java, maven<= 1.8.1GitHub
- lz4-javaaffected: < 1.11.2CVE List
- at.yawk.lz4:lz4-java, Mavenfrom first release, fixed in 1.11.2OSV
- at.yawk.lz4:lz4-java, Maven1.10.0OSV
- at.yawk.lz4:lz4-java, Maven1.10.1OSV
- at.yawk.lz4:lz4-java, Maven1.10.2OSV
- at.yawk.lz4:lz4-java, Maven1.10.3OSV
- at.yawk.lz4:lz4-java, Maven1.10.4OSV
- at.yawk.lz4:lz4-java, Maven1.11.0OSV
- at.yawk.lz4:lz4-java, Maven1.11.1OSV
- at.yawk.lz4:lz4-java, Maven1.8.1OSV
- at.yawk.lz4:lz4-java, Maven1.9.0OSV
- org.lz4:lz4-java, Mavenfrom first release, through 1.8.1OSV
- org.lz4:lz4-java, Maven1.4OSV
- org.lz4:lz4-java, Maven1.4.0OSV
- org.lz4:lz4-java, Maven1.4.1OSV
- org.lz4:lz4-java, Maven1.5.0OSV
- org.lz4:lz4-java, Maven1.5.1OSV
- org.lz4:lz4-java, Maven1.6.0OSV
- org.lz4:lz4-java, Maven1.7.0OSV
- org.lz4:lz4-java, Maven1.7.1OSV
- org.lz4:lz4-java, Maven1.8.0OSV
- org.lz4:lz4-java, Maven1.8.1OSV
References 5
- github.com/yawkat/lz4-java/commit/6492ce5aca6bd03ff9e08ee18a2beb94c431371aFixvia CVE List
- github.com/yawkat/lz4-java/releases/tag/v1.11.2Fixvia CVE List
- github.com/yawkat/lz4-java/security/advisories/GHSA-6cx8-rjf8-pr8gAdvisoryvia CVE List
- github.com/advisories/GHSA-6cx8-rjf8-pr8gAdvisoryvia GitHub
- nvd.nist.gov/vuln/detail/CVE-2026-106453Referencevia GitHub