Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessReach exposed llama-server /completion
-
DeliverySubmit GBNF grammar with {5,2}
-
ExploitTrigger integer underflow in parse_sequence
-
ExecutionWrap n_opt into endless repetition rules
-
ImpactExhaust memory and hang process
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer underflow checks
|
| Exploitation Conditions | Requires a reachable llama.cpp llama-server instance (b7118 up to but not including b12604) exposing the HTTP /completion endpoint and accepting a client-supplied 'grammar' field in GBNF; the attacker provides an inverted repetition range (max < min, e.g. {5,2}) that underflows in llama_grammar_parser::parse_sequence(). No authentication, no user interaction, and default configurations are sufficient (CVSS PR:N/UI:N). The practical limiting factor is exposure: the server must be network-accessible and must accept attacker-supplied grammars - deployments that keep llama-server private, strip/disable the grammar field, or have updated to b12604 are not exploitable. Impact is limited to availability (service hang/OOM); no confidentiality or integrity compromise. |
| Impact | Signals align toward a credible, prioritizable availability threat rather than a theoretical high score. The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N) describes a remotely reachable, unauthenticated, low-complexity attack with no user interaction, and the only impact is availability (VA:H) with no confidentiality or integrity effect - consistent with the described denial-of-service via memory exhaustion and process hang. The vuln.today decision label is 'this_week' (not act_now/emergency), and the flaw is not listed in CISA KEV; no EPSS score was supplied, so exploitation probability cannot be quantified from this data. Exploitation status: no public exploit identified at time of analysis - the references are vendor/advisory/patch links (GitHub issue, PR, commit, VulnCheck advisory), not verified working exploit code - though the description itself supplies a concrete reproducer (a '{5,2}' GBNF repetition), which lowers the practical bar to reproduce. SSVC-style reasoning: technical impact is partial (DoS only, no code execution or data loss), while automatable is plausible given a trivial, repeatable payload against an exposed endpoint. Net: a real, easy-to-trigger DoS worth patching promptly on any network-exposed llama-server, but not a confidentiality/integrity emergency. |
| Exploit ScenarioDerived | An attacker who can reach an exposed llama-server HTTP endpoint sends a POST to /completion with a GBNF grammar containing an inverted repetition range such as '{5,2}'. The integer underflow (max lower than min) wraps n_opt into a huge value, causing generation of effectively endless repetition rules that hang the process and exhaust memory, taking the inference service offline. No authentication or user interaction is required, and the description provides a working trigger payload, but no verified standalone exploit tool is cited in the input. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 25, 2026
Denial of service in llama.cpp builds b7118 through b12603 lets unauthenticated remote attackers hang the llama-server process and exhaust its memory by submitting an inverted GBNF repetition range such as {5,2} in the grammar field of a /completion request. The parser's repetition-count arithmetic underflows, wrapping the optional-count value and causing endless repetition rules to be generated from a single small request. No authentication or user interaction is required and default configurations are sufficient, so risk is driven entirely by exposure: any llama-server instance reachable over the network that accepts client-supplied grammars is a candidate. The maintainers fixed the flaw in build b12604, which rejects ranges where the maximum is lower than the minimum; no public exploit code has been confirmed and the issue is not listed as actively exploited, though the trigger is documented in the public GitHub issue and fix PR.
RemediationAI
Vendor-released patch: build b12604 or later, available at https://github.com/ggml-org/llama.cpp/releases/tag/b12604, which adds the min/max repetition validation from pull request 32551 and commit 46eb1742db6d2caec1bfa848c5702b1bdcc815e5 - upgrade any llama-server deployment currently on b7118 through b12603. Where an immediate upgrade is not possible, the practical compensating controls are to remove the exposure rather than to tune the parser: keep llama-server off untrusted networks (bind to loopback or place it behind an access-controlled proxy), or strip and reject the grammar field at the ingress layer before requests reach /completion so that no attacker-supplied GBNF is ever parsed. Both workarounds carry the trade-off that they remove grammar-constrained generation for legitimate clients, and the field-stripping approach must be implemented in a proxy that fully understands the request schema, since partial filtering that still forwards a grammar value provides no protection. Updating remains the only complete fix, because the underflow is inside llama_grammar_parser::parse_sequence() and cannot be corrected by configuration.
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp's grammar engine implements GBNF (GGML BNF), a BNF-derived notation used to constrain model sampling output; grammars are compiled by llama_grammar_parser, whose parse_sequence() routine processes repetition suffixes of the form {min,max}. The root cause is CWE-191 (integer underflow): when a client supplies a repetition range in which the maximum is smaller than the minimum (for example {5,2}), the count arithmetic in parse_sequence() underflows, so the internal optional-count value (n_opt) wraps to a very large number. The parser then materialises an unbounded number of repetition rule elements, consuming CPU and heap until the server process hangs or is killed by memory exhaustion. The upstream fix in pull request 32551 adds an explicit guard in src/llama-grammar.cpp that throws a std::runtime_error ("incorrect number of repetitions") when max_times is less than min_times, converting the silent wrap into a clean parse failure. The vulnerable code is visible in the b12603 source listing at llama-grammar.cpp lines 519-522, and the correction lands in the b12604 release tag. The affected component is a native C++ inference server rather than a managed runtime, so there is no sandbox boundary between a malformed grammar and the serving process: the only exposure gate is whether an attacker can reach the HTTP /completion endpoint with a grammar field under their control.
Know when Llama Cpp gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
Network-reachable endpoint hit unauthenticated with a trivial payload and no user interaction (AV:N/AC:L/PR:N/UI:N); impact is availability-only DoS, so C:N/I:N/A:H.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
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.
Executive ViewAI
A high-severity denial-of-service vulnerability affects llama.cpp's llama-server from builds b7118 through b12603, allowing unauthenticated attackers to crash or hang the service by sending a specially crafted request. This can disrupt any organization relying on the affected versions for AI inference services, leading to operational downtime and potential customer impact.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add
Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri
Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg
Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge
Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use
Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali
Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict
CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f
Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem
llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,
Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who
Unauthenticated remote attackers who can reach the ggml RPC server in llama.cpp b11450 before b12658 can exploit an out-
EUVD-2026-135711
GHSA-f86p-wv5j-r5vj
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB