GHSA-6cx8-rjf8-pr8g

Suggest an improvement
Source
https://github.com/advisories/GHSA-6cx8-rjf8-pr8g
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-6cx8-rjf8-pr8g/GHSA-6cx8-rjf8-pr8g.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-6cx8-rjf8-pr8g
Aliases
Published
2026-10-07T16:17:47Z
Modified
2026-10-07T16:30:05Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
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
Details

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.

Database specific
{
    "cwe_ids": [
        "CWE-789"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-07T16:17:47Z",
    "nvd_published_at": "2026-10-06T20:17:27Z",
    "severity": "MODERATE"
}
References

Affected packages

Maven / at.yawk.lz4:lz4-java

Package

Name
at.yawk.lz4:lz4-java
View open source insights on deps.dev
Purl
pkg:maven/at.yawk.lz4/lz4-java

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.11.2

Affected versions

1.*
1.8.1
1.9.0
1.10.0
1.10.1
1.10.2
1.10.3
1.10.4
1.11.0
1.11.1

Database specific

last_known_affected_version_range
"<= 1.11.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-6cx8-rjf8-pr8g/GHSA-6cx8-rjf8-pr8g.json"

Maven / org.lz4:lz4-java

Package

Name
org.lz4:lz4-java
View open source insights on deps.dev
Purl
pkg:maven/org.lz4/lz4-java

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
1.8.1

Affected versions

1.*
1.4
1.4.0
1.4.1
1.5.0
1.5.1
1.6.0
1.7.0
1.7.1
1.8.0
1.8.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-6cx8-rjf8-pr8g/GHSA-6cx8-rjf8-pr8g.json"