snappy-java's missing upper bound check on chunk length can lead to Denial of Service (DoS) impact
Published 25 Sept 2023 · Updated 10 Sept 2026
Is your project on an affected org.xerial.snappy:snappy-java?
Look after several Java apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <1.1.10.4
- Fixed in
- 1.1.10.4
mvn versions:use-dep-version -Dincludes=org.xerial.snappy:snappy-java -DdepVersion=1.1.10.4 -DforceVersion=trueDetails
Summary
snappy-java is a data compression library in Java. Its SnappyInputStream was found to be vulnerable to Denial of Service (DoS) attacks when decompressing data with a too-large chunk size. Due to missing upper bound check on chunk length, an unrecoverable fatal error can occur.
Scope
All versions of snappy-java including the latest released version 1.1.10.3. A fix is applied in 1.1.10.4
Details
While performing mitigation efforts related to CVE-2023-34455 in Confluent products, our Application Security team closely analyzed the fix that was accepted and merged into snappy-java version 1.1.10.1 in this commit. The check on line 421 only attempts to check if chunkSize is not a negative value. We believe that this is an inadequate fix as it misses an upper-bounds check for overly positive values such as 0x7FFFFFFF (or (2,147,483,647 in decimal) before actually attempting to allocate the provided unverified number of bytes via the “chunkSize” variable. This missing upper-bounds check can lead to the applications depending upon snappy-java to allocate an inappropriate number of bytes on the heap which can then cause an java.lang.OutOfMemoryError exception. Under some specific conditions and contexts, this can lead to a Denial-of-Service (DoS) attack with a direct impact on the availability of the dependent implementations based on the usage of the snappy-java library for compression/decompression needs.
PoC
Compile and run the following code:
package org.example;
import org.xerial.snappy.SnappyInputStream;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff};
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
byte[] out = new byte[50];
try {
in.read(out);
}
catch (Exception ignored) {
}
}
}Impact
Denial of Service of applications dependent on snappy-java especially if ExitOnOutOfMemoryError or CrashOnOutOfMemoryError is configured on the JVM.
Credits
Jan Werner, Mukul Khullar and Bharadwaj Machiraju from Confluent's Application Security team.
We kindly request for a new CVE ID to be assigned once you acknowledge this vulnerability.
Is GHSA-55g7-9cwv-5qfv in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected org.xerial.snappy:snappy-java, and gives you the command that fixes it.
More advisories for org.xerial.snappy:snappy-java
- HighCVE-2026-93451snappy-java: Heap buffer overflow in Snappy.uncompress*Array typed-array methods · 27 Oct 2026
- MediumCVE-2026-116590snappy-java: JVM crash from unchecked ranges in Snappy.arrayCopy and SnappyOutputStream.rawWrite · 27 Oct 2026
- HighCVE-2026-108106snappy-java: Unbounded memory allocation from attacker-declared uncompressed lengtha · 27 Oct 2026
- HighCVE-2023-34455snappy-java's unchecked chunk length leads to DoS · 15 Jun 2023
- MediumCVE-2023-34454snappy-java's Integer Overflow vulnerability in compress leads to DoS · 15 Jun 2023
- MediumCVE-2023-34453snappy-java's Integer Overflow vulnerability in shuffle leads to DoS · 15 Jun 2023
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.