Skip to content
Heist/ feed
Back to feed
High

Potential memory exhaustion attack due to sparse slice deserialization

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2024-37298
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 01:14 UTC · Revision 1

Source evidence

Potential memory exhaustion attack due to sparse slice deserialization

core-osv · Original source

Published 1 Jul 2024, 18:27 UTC

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.

osv:CVE-2024-37298
Complete source record
{
  "id": "4fd306ca498392e01eb350cab99e82b10ba6ca546fa1dda98617f834eaa5adfd",
  "url": "https://osv.dev/vulnerability/CVE-2024-37298",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Potential memory exhaustion attack due to sparse slice deserialization",
    "summary": "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.",
    "evidence": "osv:CVE-2024-37298",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2024-37298",
      "aliases": [
        "CVE-2024-37298",
        "GHSA-3669-72x9-r9p3",
        "GO-2024-2958"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/gorilla/schema",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "cd59f2f12cbdfa9c06aa63e425d1fe4a806967ff"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.4.1"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "cd59f2f12cbdfa9c06aa63e425d1fe4a806967ff"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.4.1"
                      }
                    ],
                    "source": "DESCRIPTION"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v1.4.0",
            "v1.3.0",
            "v1.2.1",
            "v1.2.0",
            "v1.1.0",
            "v1.0.2",
            "v1.0.1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-37298.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:41.237982073Z",
      "provider": "osv",
      "references": [
        "https://github.com/gorilla/schema/blob/main/decoder.go#L223",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/37xxx/CVE-2024-37298.json",
        "https://github.com/gorilla/schema/security/advisories/GHSA-3669-72x9-r9p3",
        "https://nvd.nist.gov/vuln/detail/CVE-2024-37298",
        "https://github.com/gorilla/schema/commit/cd59f2f12cbdfa9c06aa63e425d1fe4a806967ff"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-770"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/37xxx/CVE-2024-37298.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-37298",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 508965,
  "published_at": "2024-07-01T18:27:33.952+00:00"
}