salvepilo commited on
Commit
2ce58b4
·
verified ·
1 Parent(s): 6bf733b

Add README

Browse files
Files changed (1) hide show
  1. README.md +39 -0
README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - security
5
+ - llama.cpp
6
+ - gguf
7
+ - poc
8
+ ---
9
+
10
+ # llama.cpp Gemma3 Integer Division-by-Zero PoC
11
+
12
+ Proof-of-concept for a division-by-zero vulnerability in llama.cpp's Gemma3 architecture loader.
13
+
14
+ **Vulnerable file:** `src/models/gemma3.cpp:32`
15
+
16
+ ## Files
17
+
18
+ - `poc_gemma3_divzero.gguf` — 235-byte malicious GGUF (no tensors, triggers SIGFPE on x86_64)
19
+ - `reproducer.cpp` — standalone C++ reproducer (no llama.cpp build needed)
20
+
21
+ ## Quick test
22
+
23
+ ```bash
24
+ # Standalone (no llama.cpp needed)
25
+ g++ -o reproducer reproducer.cpp -fsanitize=undefined -fno-sanitize-recover=all
26
+ ./reproducer
27
+ # Expected: runtime error: division by zero
28
+
29
+ # With llama.cpp
30
+ ./llama-cli -m poc_gemma3_divzero.gguf -p 'hello'
31
+ # Expected on x86_64: Floating point exception (exit 136)
32
+ ```
33
+
34
+ ## Root cause
35
+
36
+ When `block_count=62` (→ `LLM_TYPE_27B`) and `attention.head_count` is absent from the GGUF,
37
+ `n_head(0)` returns 0 and the expression `n_embd / n_head(0)` is integer division-by-zero.
38
+
39
+ Reported via [Huntr](https://huntr.com) bug bounty program.