Integer Underflow Vulnerability in Llama.cpp by GGML
CVE-2026-137057
8.7HIGH
What is CVE-2026-137057?
An integer underflow vulnerability exists in the llama_grammar_parser::parse_sequence() function of llama.cpp versions prior to b12604. This weakness allows unauthenticated remote attackers to exploit the grammar field of a llama-server /completion request by providing GBNF repetitions where the maximum value is less than the minimum value. Specifically, attackers can craft grammars like {5,2}, which can cause the parsing process to enter a loop that leads to excessive memory consumption and ultimately a denial of service. This vulnerability poses a significant risk as it can be triggered remotely without authentication.
Affected Version(s)
llama.cpp b7118
