You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The uncompress() method in snappy-java lacks proper validation of the uncompressedLength, which leads to a potential Denial of Service (DoS) vulnerability. Specifically, with only 5 bytes of input, the library becomes vulnerable to DoS attacks.
Details
In the Snappy.java, the uncompress() method is implemented as follows:
When creating the new byte[] array, there is no upper bounds check on the uncompressedLength. As a result, if uncompressedLength is too large, it can lead to an OutOfMemoryError, similar to the vulnerability of snappy-java described in GHSA-55g7-9cwv-5qfv (GitHub advisory).
This will produce the following exception: java.lang.OutOfMemoryError
Similarly, as seen in GHSA-pqr6-cmr2-h8hf (GitHub advisory), the absence of lower bounds checks on uncompressedLength can lead to a NegativeArraySizeException due to integer overflow.
This will produce the following exception: java.lang.NegativeArraySizeException
Impact Denial of Service (DoS).
Mitigation
To resolve this issue, we suggest adding bounds validation in the uncompress() method before allocating the array. Specifically, ensure that Snappy.uncompressedLength(input) is greater than 0 and below a reasonable upper limit, similar to the fix applied in GHSA-55g7-9cwv-5qfv.
The text was updated successfully, but these errors were encountered:
Description
The uncompress() method in snappy-java lacks proper validation of the uncompressedLength, which leads to a potential Denial of Service (DoS) vulnerability. Specifically, with only 5 bytes of input, the library becomes vulnerable to DoS attacks.
Details
In the Snappy.java, the uncompress() method is implemented as follows:
When creating the new byte[] array, there is no upper bounds check on the uncompressedLength. As a result, if uncompressedLength is too large, it can lead to an OutOfMemoryError, similar to the vulnerability of snappy-java described in GHSA-55g7-9cwv-5qfv (GitHub advisory).
Proof of Concept (PoC) 1
This will produce the following exception:
java.lang.OutOfMemoryError
Similarly, as seen in GHSA-pqr6-cmr2-h8hf (GitHub advisory), the absence of lower bounds checks on uncompressedLength can lead to a NegativeArraySizeException due to integer overflow.
Proof of Concept (PoC) 2
This will produce the following exception:
java.lang.NegativeArraySizeException
Impact
Denial of Service (DoS).
Mitigation
To resolve this issue, we suggest adding bounds validation in the uncompress() method before allocating the array. Specifically, ensure that Snappy.uncompressedLength(input) is greater than 0 and below a reasonable upper limit, similar to the fix applied in GHSA-55g7-9cwv-5qfv.
The text was updated successfully, but these errors were encountered: