Llama.cpp: Denial of service via grammar parsing
HighAI-generated2026-11-26
- CVE
- CVE-2026-137057
- Severity
- High (CVSS 7.5)
- Attack conditions
- Remotely, over the network · No account needed · No user action needed
- Exploitation probability (EPSS)
- 1.2% (within 30 days; FIRST EPSS, 30 November 2026)
Summary
The llama.cpp library versions before b12604 contain an integer underflow bug that can be triggered by a crafted grammar, leading to denial-of-service conditions.
Details
According to the NVD record, llama.cpp versions from commit b7118 up to but not including b12604 have an integer underflow flaw in the function that parses grammar sequences. The vulnerability is triggered when a remote user supplies a grammar with a repetition range where the maximum value is lower than the minimum, such as {5,2}.
An attacker can exploit this by sending a specially crafted request to a llama-server /completion endpoint. The malformed grammar causes the parser to enter an endless loop, consuming CPU and memory until the process hangs or crashes, resulting in a denial of service.
What to do
The source record does not name a specific patch, fixed version or workaround. General measures:
- Follow the vendor's security advisories.
- Apply the update when it is released.
- Limit access to the product as much as possible, especially from the internet.
Sources
Timeline
- 25 November 2026 NVD record published
- 26 November 2026 This article was written