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.
Metrics
Affected Vendors & Products
References
History
Wed, 18 Jun 2025 14:15:00 +0000
Type | Values Removed | Values Added |
---|---|---|
Metrics |
ssvc
|
Tue, 17 Jun 2025 20:15:00 +0000
Type | Values Removed | Values Added |
---|---|---|
Title | llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model |
Tue, 17 Jun 2025 20:45:00 +0000
Type | Values Removed | Values Added |
---|---|---|
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. | |
Weaknesses | CWE-119 CWE-195 |
|
References |
| |
Metrics |
cvssV3_1
|

Status: PUBLISHED
Assigner: GitHub_M
Published: 2025-06-17T20:04:40.893Z
Updated: 2025-06-18T13:41:11.407Z
Reserved: 2025-06-11T14:33:57.800Z
Link: CVE-2025-49847

Updated: 2025-06-18T13:40:46.678Z

Status : Awaiting Analysis
Published: 2025-06-17T20:15:32.437
Modified: 2025-06-17T20:50:23.507
Link: CVE-2025-49847

No data.