Skip to content

CVE-2025-49847 llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model

HighCVSS 8.8 EPSS 0.55%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
Proof of concept public · automatable: no · technical impact: total
Technology
UbuntuDebian

Description

llama.cpp is an inference of several LLM models in C/C++. Prior to version b5662, an attacker‐supplied GGUF model vocabulary can trigger a buffer overflow in llama.cpp’s vocabulary‐loading code. Specifically, the helper _try_copy in llama.cpp/src/vocab.cpp: llama_vocab::impl::token_to_piece() casts a very large size_t token length into an int32_t, causing the length check (if (length < (int32_t)size)) to be bypassed. As a result, memcpy is still called with that oversized size, letting a malicious model overwrite memory beyond the intended buffer. This can lead to arbitrary memory corruption and potential code execution. This issue has been patched in version b5662.

Upgrade path

5 packages: 2 fixed, 2 with no fix yet.

PackageAffectedFixed inStatus
ubuntu/llama.cpp(Ubuntu 26.04) All versions No fix listed No fix yet
ubuntu/llama.cpp(Ubuntu 26.10) All versions No fix listed No fix yet
debian/llama.cpp(Debian 14) < 5713+dfsg-1; = 5151+dfsg-1~exp2; = 5151+dfsg-1~exp3; = 5318+dfsg-1 +1 more 5713+dfsg-1 Fixed
ggml llama.cpp < b5662 b5662 Fixed
ggml-org llama.cpp = < b5662 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
debian/llama.cpp(Debian:14) < 5713+dfsg-1 5713+dfsg-1
debian/llama.cpp(Debian:14) = 5151+dfsg-1~exp2 No fix listed
debian/llama.cpp(Debian:14) = 5151+dfsg-1~exp3 No fix listed
debian/llama.cpp(Debian:14) = 5318+dfsg-1 No fix listed
debian/llama.cpp(Debian:14) = 5318+dfsg-2 No fix listed
ggml-org llama.cpp = < b5662 No fix listed
ubuntu/llama.cpp(Ubuntu:26.04) All versions No fix listed
ggml llama.cpp < b5662 b5662
ubuntu/llama.cpp(Ubuntu:26.10) All versions No fix listed

References