GHSA-4v53-57pg-c464

Suggest an improvement
Source
https://github.com/advisories/GHSA-4v53-57pg-c464
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-4v53-57pg-c464/GHSA-4v53-57pg-c464.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-4v53-57pg-c464
Aliases
Published
2026-10-07T16:17:50Z
Modified
2026-10-07T16:30:04Z
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: LZ4BlockInputStream allocates an unvalidated compressed length from the stream header
Details

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.

Database specific
{
    "cwe_ids": [
        "CWE-789"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-07T16:17:50Z",
    "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-4v53-57pg-c464/GHSA-4v53-57pg-c464.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-4v53-57pg-c464/GHSA-4v53-57pg-c464.json"