# CVE-2024-36124: iq80 Snappy has an out-of-bounds read when uncompressing data, leading to JVM crash

> Attackers can crash the JVM by providing malicious compressed data to the iq80 Snappy library due to an out-of-bounds read vulnerability.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Jun 2024
- **Updated:** 5 Sep 2024
- **Also known as:** GHSA-8wh2-6qhj-h7j9, ROOT-APP-MAVEN-CVE-2024-36124

## What is CVE-2024-36124?

CVE-2024-36124 is a medium-severity memory corruption vulnerability in dain snappy, published on 3 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

iq80 Snappy is a compression/decompression library. When uncompressing certain data, Snappy tries to read outside the bounds of the given byte arrays. Because Snappy uses the JDK class `sun.misc.Unsafe` to speed up memory access, no additional bounds checks are performed and this has similar security consequences as out-of-bounds access in C or C++, namely it can lead to non-deterministic behavior or crash the JVM. iq80 Snappy is not actively maintained anymore. As quick fix users can upgrade to version 0.5.

Weakness: CWE-125 (Out-of-bounds Read)

## Which versions are affected by CVE-2024-36124?

2 open source packages ship an affected version, including org.iq80.snappy:snappy. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.iq80.snappy:snappy` | Maven | All versions | 0.5 |
| `org.iq80.snappy:snappy` | Maven | All versions | 0.5 |

Products: Dain Snappy.

## How do I fix CVE-2024-36124?

Upgrade org.iq80.snappy:snappy to 0.5 or later.

## Is CVE-2024-36124 being exploited?

There is no known exploitation of CVE-2024-36124 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-36124 and fix it if it is affected.

What it is: CVE-2024-36124 is a medium-severity memory corruption vulnerability in dain snappy, published on 3 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-36124 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.iq80.snappy:snappy (Maven): affected all versions; fixed in 0.5
- org.iq80.snappy:snappy (Maven): affected all versions; fixed in 0.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-36124/ (Markdown: https://insights.sbomify.com/CVE-2024-36124/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-36124
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-36124
- OSV: https://osv.dev/vulnerability/CVE-2024-36124

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-36124/
Summaries are generated and may contain mistakes; the official description above is the record.
