{
  "affected": [
    {
      "ranges": [
        {
          "database_specific": {
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "b7118"
                  },
                  {
                    "fixed": "b12604"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StandardRange"
              },
              {
                "range": [
                  {
                    "fixed": "46eb1742db6d2caec1bfa848c5702b1bdcc815e5"
                  }
                ],
                "source": "REFERENCES_COMMIT"
              },
              {
                "original_tag": "b12604",
                "range": [
                  {
                    "fixed": "46eb1742db6d2caec1bfa848c5702b1bdcc815e5"
                  }
                ],
                "source": "REFERENCES_TAG"
              }
            ]
          },
          "events": [
            {
              "introduced": "92c0b387a9301ad6f9a180898d970b9cd7831716"
            },
            {
              "fixed": "46eb1742db6d2caec1bfa848c5702b1bdcc815e5"
            }
          ],
          "repo": "https://github.com/ggml-org/llama.cpp",
          "type": "GIT"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "VulnCheck",
    "cwe_ids": [
      "CWE-191"
    ],
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/137xxx/CVE-2026-137057.json"
  },
  "details": "llama.cpp from b7118 before b12604 contains an integer underflow vulnerability in llama_grammar_parser::parse_sequence() that allows unauthenticated remote attackers to cause denial of service by supplying GBNF repetitions with max lower than min. Attackers can send a grammar like {5,2} in the grammar field of a llama-server /completion request, wrapping n_opt to generate endless repetition rules that hang the process and exhaust memory.",
  "id": "CVE-2026-137057",
  "modified": "2026-11-25T20:45:15.524294841Z",
  "published": "2026-11-25T19:33:20.574Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/137xxx/CVE-2026-137057.json"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/ggml-org/llama.cpp"
    },
    {
      "type": "ARTICLE",
      "url": "https://github.com/ggml-org/llama.cpp/blob/b12603/src/llama-grammar.cpp#L519-L522"
    },
    {
      "type": "FIX",
      "url": "https://github.com/ggml-org/llama.cpp/commit/46eb1742db6d2caec1bfa848c5702b1bdcc815e5"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/ggml-org/llama.cpp/issues/32550"
    },
    {
      "type": "FIX",
      "url": "https://github.com/ggml-org/llama.cpp/pull/32551"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/ggml-org/llama.cpp/releases/tag/b12604"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-137057"
    },
    {
      "type": "ADVISORY",
      "url": "https://www.vulncheck.com/advisories/llama-cpp-b7118-before-b12604-integer-underflow-in-grammar-parser-parse-sequence"
    }
  ],
  "schema_version": "1.9.2",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "llama.cpp b7118 before b12604 Integer Underflow in Grammar Parser parse_sequence"
}