# CVE-2024-37298: Potential memory exhaustion attack due to sparse slice deserialization

> Attackers can cause memory exhaustion and denial of service by exploiting sparse slice deserialization in the gorilla/schema library.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jul 2024
- **Updated:** 2 Aug 2024
- **Also known as:** AZL-43071, AZL-43083, AZL-43103, AZL-43146, AZL-43474, AZL-44949, DEBIAN-CVE-2024-37298, GHSA-3669-72x9-r9p3, GO-2024-2958, RHSA-2024:4702, RHSA-2024:4825, RHSA-2024:4848, UBUNTU-CVE-2024-37298

## What is CVE-2024-37298?

CVE-2024-37298 is a high-severity denial of service vulnerability in gorilla schema, published on 1 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

gorilla/schema converts structs to and from form values. Prior to version 1.4.1 Running `schema.Decoder.Decode()` on a struct that has a field of type `[]struct{...}` opens it up to malicious attacks regarding memory allocations, taking advantage of the sparse slice functionality. Any use of `schema.Decoder.Decode()` on a struct with arrays of other structs could be vulnerable to this memory exhaustion vulnerability. Version 1.4.1 contains a patch for the issue.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling)

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

3 open source packages ship an affected version, including github.com/gorilla/schema.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gorilla/schema` | Go | All versions | 1.4.1 |
| `github.com/gorilla/schema` | Go | All versions | 1.4.1 |
| `github.com/gorilla/schema` | Go | All versions | 1.4.1 |
| `podman` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-catatonit` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-catatonit-debuginfo` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-debuginfo` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-debugsource` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-docker` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-gvproxy` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-gvproxy-debuginfo` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-plugins` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-plugins-debuginfo` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-remote` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-remote-debuginfo` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman-tests` | Red Hat:openshift:4.13::el8 | All versions | 3:4.4.1-9.3.rhaos4.13.el8 |
| `podman` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-debuginfo` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-debugsource` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-docker` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-gvproxy` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-gvproxy-debuginfo` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-plugins` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-plugins-debuginfo` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-remote` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-remote-debuginfo` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman-tests` | Red Hat:openshift:4.13::el9 | All versions | 3:4.4.1-10.3.rhaos4.13.el9 |
| `podman` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-catatonit` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-catatonit-debuginfo` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-debuginfo` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-debugsource` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-docker` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-gvproxy` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-gvproxy-debuginfo` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-plugins` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-plugins-debuginfo` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-remote` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-remote-debuginfo` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |
| `podman-tests` | Red Hat:openshift:4.15::el8 | All versions | 3:4.4.1-25.2.rhaos4.15.el8 |

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

Upgrade github.com/gorilla/schema to 1.4.1 or later.

## Is CVE-2024-37298 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-37298 exists.

## Fix prompt for AI coding agents

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

What it is: CVE-2024-37298 is a high-severity denial of service vulnerability in gorilla schema, published on 1 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-37298 exists.

Affected packages and fixed versions:
- github.com/gorilla/schema (Go): affected all versions; fixed in 1.4.1
- github.com/gorilla/schema (Go): affected all versions; fixed in 1.4.1
- github.com/gorilla/schema (Go): affected all versions; fixed in 1.4.1

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-37298/ (Markdown: https://insights.sbomify.com/CVE-2024-37298/index.md)
```

## Sources

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

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