Vulnerability · Published Jun 17, 2025 · Assigned by GitHub_M
CVE-2025-49847llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model
High 8.8
In plain English
A high-severity memory corruption in llama.cpp from ggml-org. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.5% (higher than 44% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:14 | llama.cpp | 5713+dfsg-1 | DEBIAN-CVE-2025-49847 |
| Ubuntu:25.10 | llama.cpp | no fix listed | UBUNTU-CVE-2025-49847 |
| Ubuntu:26.04:LTS | llama.cpp | no fix listed | UBUNTU-CVE-2025-49847 |
| Ubuntu:26.10 | llama.cpp | no fix listed | UBUNTU-CVE-2025-49847 |
Affected products (as reported)
Weakness: CWE-119, CWE-195 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H