Skip to main content
VulnerabilityPublished

CVE-2025-49847: ggml-org llama.cpp · Memory Buffer Overflow

Affects ggml-org llama.cppSource CVE Database V5

0

Not known to be exploited · CVSS 8.8 High : upgrade to b5662 soon.

Data as of 26 Oct 2026, 14:05 UTC

CVSS 3.1 base score
8.8High
How severe the flaw is on the 0–10 CVSS scale.
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:H

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 17 Jun 2025

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq 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

ProductAffectedFixed in
GitHubggml-org/llama.cpppkg:github/ggml-org/llama.cppOther threatsAffected
  • <b5662
Fixed in
  • b5662

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

  1. Immediate upgrade to llama.cpp version b5662 or later, where the vulnerability is patched.
  2. Implement strict validation and sanitization of all GGUF model vocabularies before loading, including verifying token lengths and rejecting suspiciously large or malformed tokens.
  3. Restrict model loading to trusted sources only; avoid loading models from unverified third parties or unknown origins.
  4. Employ runtime memory protection mechanisms such as Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP) to mitigate exploitation impact.
  5. Monitor and log all model loading activities to detect anomalous or unexpected model files.
  6. Educate users on the risks of loading untrusted models and enforce policies to prevent unauthorized model usage.
  7. For organizations embedding llama.cpp in larger systems, conduct thorough code audits and fuzz testing focused on vocabulary processing components.
  8. Consider sandboxing the inference environment to contain potential exploitation effects.
  9. 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.

References

Community reviews

Loading reviews…