Summary
CVE-2026-137057 is an integer underflow vulnerability (CWE-191) in llama.cpp’s GBNF grammar parser. It allows unauthenticated remote attackers to cause a denial of service. The CVE record rates it 8.7 (High) under CVSS v4.0.
Technical details
- Root cause: integer underflow in
llama_grammar_parser::parse_sequence()when a GBNF repetition has a maximum lower than its minimum. - Trigger: an attacker supplies a malicious grammar containing a repetition such as
{5,2}in a completion request. - Attack vector: network, with no authentication or user interaction required.
- Impact: the process hangs and exhausts memory through endless repetition rules, causing denial of service.
- Credit: discovered by Daniil Kuts.
Affected software
- llama.cpp (ggml-org) builds b7118 through b12603 inclusive.
Severity
- CVSS v4.0: 8.7 (High),
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 - CVSS v3.1: 7.5 (High),
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Mitigation and recommended actions
- Immediate: upgrade llama.cpp to build b12604 or later.
- If you cannot patch immediately: I did not find vendor-documented workarounds. As general hardening, avoid exposing llama.cpp server endpoints to untrusted networks and restrict access to trusted clients.

