CVE-2025-49847 Details
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.
A buffer overflow vulnerability has been identified in llama.cpp, an inference library for various LLM models, prior to version b5662. The issue arises in the vocabulary-loading code, specifically within the function 'llama_vocab::impl::token_to_piece()'. Here, an attacker-supplied GGUF model vocabulary can trigger the vulnerability by providing a token length that exceeds the maximum limit. This oversized length bypasses the length check, leading to an unchecked 'memcpy' operation that allows for arbitrary memory corruption. Such memory corruption can potentially be exploited for code execution.
Users should update to llama.cpp version b5662 or later, where this vulnerability has been patched.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Jun 18, 2025References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/ggml-org/llama.cpp/commit/3cfbbdb44e08fd19429fed6cc85b982a91f0efd5 | [email protected] | Patch |
| https://github.com/ggml-org/llama.cpp/security/advisories/GHSA-8wwf-w4qm-gpqr | [email protected] | MitigationVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-119 | Improper Restriction of Operations within the Bounds of a Memory Buffer | [email protected] |
| CWE-195 | Signed to Unsigned Conversion Error | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| ggml llama.cpp | < b5662 |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Aug 27, 2025 | Initial Analysis | [email protected] |
| Jun 17, 2025 | New CVE Received | [email protected] |