Downloads · 30 days
10
24% of all-time downloads
salvepilo/llama-cpp-gemma3-divzero-poc
llama-cpp-gemma3-divzero-poc is a machine learning model from salvepilo. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Proof-of-concept for a division-by-zero vulnerability in llama.cpp's Gemma3 architecture loader.
Downloads · 30 days
10
24% of all-time downloads
All-time downloads
41
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.cpp2.9 KB · 51%
From the Hugging Face model README
Proof-of-concept for a division-by-zero vulnerability in llama.cpp's Gemma3 architecture loader.
Vulnerable file: src/models/gemma3.cpp:32
poc_gemma3_divzero.gguf — 235-byte malicious GGUF (no tensors, triggers SIGFPE on x86_64)reproducer.cpp — standalone C++ reproducer (no llama.cpp build needed)# Standalone (no llama.cpp needed)
g++ -o reproducer reproducer.cpp -fsanitize=undefined -fno-sanitize-recover=all
./reproducer
# Expected: runtime error: division by zero
# With llama.cpp
./llama-cli -m poc_gemma3_divzero.gguf -p 'hello'
# Expected on x86_64: Floating point exception (exit 136)
When block_count=62 (→ LLM_TYPE_27B) and attention.head_count is absent from the GGUF,
n_head(0) returns 0 and the expression n_embd / n_head(0) is integer division-by-zero.
Reported via Huntr bug bounty program.