CVE-2025-49847: ggml-org llama.cpp · Memory Buffer Overflow
Affects ggml-org llama.cppSource CVE Database V5
Not known to be exploited · CVSS 8.8 High : upgrade to b5662 soon.
Data as of 26 Oct 2026, 14:05 UTC
- EPSS
- 0.5% chance of exploitation in 30 days – higher than 43% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
- Patch
- Available – fixed in b5662
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HExploitation evidence
Disclosed: evidence found.
CVE published 17 Jun 2025
Detectable: no evidence on record.
No public nuclei template indexed
Weaponised: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.
What to do
Upgrade ggml-org/llama.cpp to b5662.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
GitHubggml-org/llama.cpppkg:github/ggml-org/llama.cppOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
- Immediate upgrade to llama.cpp version b5662 or later, where the vulnerability is patched.
- Implement strict validation and sanitization of all GGUF model vocabularies before loading, including verifying token lengths and rejecting suspiciously large or malformed tokens.
- Restrict model loading to trusted sources only; avoid loading models from unverified third parties or unknown origins.
- Employ runtime memory protection mechanisms such as Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP) to mitigate exploitation impact.
- Monitor and log all model loading activities to detect anomalous or unexpected model files.
- Educate users on the risks of loading untrusted models and enforce policies to prevent unauthorized model usage.
- For organizations embedding llama.cpp in larger systems, conduct thorough code audits and fuzz testing focused on vocabulary processing components.
- Consider sandboxing the inference environment to contain potential exploitation effects.
- Maintain up-to-date threat intelligence feeds to detect emerging exploitation attempts.
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.