How to use from
llama.cpp
Install from brew
brew install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf salvepilo/llama-cpp-scores-oob-poc
# Run inference directly in the terminal:
llama-cli -hf salvepilo/llama-cpp-scores-oob-poc
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf salvepilo/llama-cpp-scores-oob-poc
# Run inference directly in the terminal:
llama-cli -hf salvepilo/llama-cpp-scores-oob-poc
Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf salvepilo/llama-cpp-scores-oob-poc
# Run inference directly in the terminal:
./llama-cli -hf salvepilo/llama-cpp-scores-oob-poc
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf salvepilo/llama-cpp-scores-oob-poc
# Run inference directly in the terminal:
./build/bin/llama-cli -hf salvepilo/llama-cpp-scores-oob-poc
Use Docker
docker model run hf.co/salvepilo/llama-cpp-scores-oob-poc
Quick Links

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

llama-cpp-scores-oob-poc

Heap Buffer Over-Read via Mismatched Tokenizer Array Lengths in GGUF

This repository contains a proof-of-concept (PoC) demonstrating a heap buffer over-read vulnerability in llama.cpp caused by mismatched tokenizer array lengths in a crafted GGUF model file.

Vulnerability Summary

When loading a GGUF model, llama.cpp reads tokenizer metadata arrays (such as token scores and token types) and assumes their lengths match the vocabulary size. A specially crafted GGUF file can provide arrays with fewer elements than the declared vocabulary size, causing llama.cpp to read beyond the bounds of the allocated heap buffer when accessing token scores.

This results in a heap buffer over-read, which may lead to information disclosure or a crash.

Files

File Description
poc_scores_oob.gguf Crafted GGUF model file that triggers the vulnerability
poc_scores_oob.py Python script used to generate the malicious GGUF file

Reproduction

# Build llama.cpp, then run with the crafted model:
./llama-cli -m poc_scores_oob.gguf -p "test"

Disclaimer

This PoC is provided for security research and responsible disclosure purposes only. Do not use it for malicious purposes.

Downloads last month
15
GGUF
Model size
74.3k params
Architecture
llama
Hardware compatibility
Log In to add your hardware

We're not able to determine the quantization variants.

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support