GBNF Grammar DoS PoC
This repository contains a Proof of Concept (PoC) for a Denial of Service (DoS) vulnerability in llama.cpp's GBNF grammar parser.
Vulnerability
The GBNF parser in llama.cpp (prior to the fix) allows unlimited recursion when parsing nested parentheses. A grammar with deeply nested groups (e.g., ((...))) causes a stack overflow, crashing the application.
Files
dos.gbnf: A malicious grammar file containing 100,000 nested parentheses.
Reproduction
To reproduce the crash (on a vulnerable version):
./llama-cli -m your_model.gguf --grammar-file dos.gbnf -p "test"
Mitigation
This vulnerability is fixed by enforcing a recursion depth limit in llama_grammar_parser.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support