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.

Severity (CVSS 3.1)8.8High
Exploit odds (30 days)0.5%top 55.9% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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

EcosystemPackageFixed inAdvisory
Debian:14llama.cpp5713+dfsg-1DEBIAN-CVE-2025-49847
Ubuntu:25.10llama.cppno fix listedUBUNTU-CVE-2025-49847
Ubuntu:26.04:LTSllama.cppno fix listedUBUNTU-CVE-2025-49847
Ubuntu:26.10llama.cppno fix listedUBUNTU-CVE-2025-49847

Affected products (as reported)

VendorProductVersions
ggml-org llama.cpp < b5662

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

References