{"id":"CVE-2025-49847","published":"2025-06-17T20:04:40Z","modified":"2025-06-18T13:41:11Z","title":"llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model","vendor":"ggml-org","product":"llama.cpp","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00553,"percentile":0.47066,"provenance":"source"},"cwes":[{"id":"CWE-119","name":"Improper Restriction of Operations within the Bounds of a Memory Buffer"},{"id":"CWE-195","name":"Signed to Unsigned Conversion Error"}],"references":[{"url":"https://github.com/ggml-org/llama.cpp/security/advisories/GHSA-8wwf-w4qm-gpqr","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/ggml-org/llama.cpp/commit/3cfbbdb44e08fd19429fed6cc85b982a91f0efd5","tags":["x_refsource_MISC"]}],"priority":{"score":15.6,"factors":[{"name":"EPSS percentile","points":9.41},{"name":"CVSS severity","points":6.16}]},"vendorSlug":"ggml-org","affectedVersions":[{"vendor":"ggml-org","product":"llama.cpp","versions":["< b5662"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2025-06-18T13:40:43.172535Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2025-18632","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-ggml-org-llama-cpp-cve-2025-49847","children":[{"from":"CVE-2025-49847","to":"CVE-2025-52566","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/llama-vocab.cpp"],"commits":["https://github.com/ggml-org/llama.cpp/commit/3cfbbdb44e08fd19429fed6cc85b982a91f0efd5","https://github.com/ggml-org/llama.cpp/commit/dd6e6d0b6a4bbe3ebfc931d1eb14db2f2b1d70af"],"basis":"rarely changed file"}]},{"from":"CVE-2025-49847","to":"CVE-2025-71439","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/llama-vocab.cpp"],"commits":["https://github.com/ggml-org/llama.cpp/commit/3cfbbdb44e08fd19429fed6cc85b982a91f0efd5","https://github.com/ggml-org/llama.cpp/commit/c33fe8b8c4427202706b1434e9fc8ab5752c9cac"],"basis":"rarely changed file"}]}]}}