# CVE-2025-49847: llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model

- Severity: High 8.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.55%, higher than 47% of CVEs (2026-12-01)
- Published: 2025-06-17T20:04:40.893Z
- Modified: 2026-06-17T09:32:00.730Z
- Weaknesses: CWE-119, CWE-195
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- ggml-org llama.cpp: < b5662
- ggml llama.cpp: before b5662

## References

- <https://github.com/ggml-org/llama.cpp/security/advisories/GHSA-8wwf-w4qm-gpqr> (mitigation, vendor-advisory)
- <https://github.com/ggml-org/llama.cpp/commit/3cfbbdb44e08fd19429fed6cc85b982a91f0efd5> (patch)

## Sources

- CVE List: [CVE-2025-49847](https://www.cve.org/CVERecord?id=CVE-2025-49847), CVE Terms of Use, modified 2025-06-18
- NVD: [CVE-2025-49847](https://nvd.nist.gov/vuln/detail/CVE-2025-49847), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2025-49847 · Whole record: https://cve.day/CVE-2025-49847.json · Rebuilt by cve.day 2026-11-25T22:58:59.322Z
