Abhnv7/huntr-poc-bug06-llamacpp-gguf-sigfpe-dos
08
BUG06 — llama.cpp GGUF SIGFPE (integer divide-by-zero, DoS)
A crafted .gguf file with a tensor dimension ne[1] = 0 triggers an integer division-by-zero (INT64_MAX / ne[1]) during GGUF parsing, crashing the process with SIGFPE before any model is loaded.
- Repo: https://github.com/ggml-org/llama.cpp
- Latest commit tested: 715b86a3663648211347d2bb0cf3beb8fc057f2b (origin/master)
- Pinned comparison: d403f00ec3036057a924af3e9738397042c5441b (also crashes)
- Vulnerable code: ggml/src/gguf.cpp:681 in
gguf_init_from_reader - Severity: Medium (DoS, CWE-369 Divide By Zero)
Reproduce
python3 generate_poc_bug06.py # writes poc_bug06.gguf (75 bytes)
./build/bin/llama-cli --model poc_bug06.gguf --n-predict 1
echo $? # 136 = 128 + SIGFPE(8)Result
Thread 1 received signal SIGFPE, Arithmetic exception at gguf.cpp:681 (gguf_init_from_reader). Full gdb backtrace in BUG06-actual-log.txt.
PoC SHA256: a46fbee54d38c8a7c4aac49aea75d6b0c412d4aa959ed5a3f9ae8d320891426d
