| license: mit | |
| library_name: gguf | |
| tags: | |
| - security | |
| - poc | |
| - vulnerability | |
| # PoC: GGUF Integer Overflow Vulnerability | |
| This repository contains a Proof-of-Concept (PoC) model file (`gguf_overflow.gguf`) demonstrating a critical **Integer Overflow** vulnerability in standard GGUF parsers (like `llama.cpp/ggml`). | |
| ## Vulnerability Details | |
| The GGUF format allows defining tensor dimensions. If a tensor is defined with dimensions that fit within a 64-bit element count but result in a byte size exceeding $2^{64}$ when multiplied by the data type size (e.g., Float32 = 4 bytes), the size calculation overflows module $2^{64}$. | |
| This leads to a tiny memory allocation (e.g., 4 bytes) for a massive tensor, causing **Heap Corruption** when the parser attempts to read/write the tensor data. | |
| ## Files | |
| - `gguf_overflow.gguf`: The malicious model file. | |
| - `poc_gguf_overflow.py`: Script used to generate the model. | |
| ## Usage | |
| **WARNING: This file may crash your system or corrupt memory. Run in a sandboxed environment.** | |
| ```bash | |
| # Verify with llama.cpp | |
| ./llama-cli -m gguf_overflow.gguf | |
| ``` | |