CVE-2025-52566 llama.cpp tokenizer signed vs. unsigned heap overflow
An attacker can trigger a heap overflow via manipulated text input in the llama.cpp tokenizer, potentially leading to code execution or denial of service.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2025-52566?
CVE-2025-52566 is a high-severity vulnerability in ggml-org llama.cpp, published on 24 Jun 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
llama.cpp is an inference of several LLM models in C/C++. Prior to version b5721, there is a signed vs. unsigned integer overflow in llama.cpp's tokenizer implementation (llama_vocab::tokenize) (src/llama-vocab.cpp:3036) resulting in unintended behavior in tokens copying size comparison. Allowing heap-overflowing llama.cpp inferencing engine with carefully manipulated text input during tokenization process. This issue has been patched in version b5721.
Which versions are affected by CVE-2025-52566?
It affects 1 product.
Products include Ggml Llama.cpp.
How do I fix CVE-2025-52566?
Upgrade to a fixed version.
Is CVE-2025-52566 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-52566 exists.
Other vulnerabilities in ggml-org llama.cpp
- CVE-2024-42479 llama.cpp allows write-what-where in rpc_server::set_tensor
- CVE-2026-34159 llama.cpp: Unauthenticated RCE via GRAPH_COMPUTE buffer=0 bypass in llama.cpp RPC backend
- CVE-2026-43629 llama.cpp b4882–b9058 Buffer Overflow in KV Cache State Restore
- CVE-2026-43631 llama.cpp b7492–b9060 Use-After-Free RCE via llama-server
- CVE-2026-43632 llama.cpp b7492–b9060 Use-After-Free in Tokenization Endpoints
Sources
Also known as DEBIAN-CVE-2025-52566, GHSA-7rxv-5jhh-j6xx, OESA-2025-2371, OESA-2025-2372, OESA-2025-2373, UBUNTU-CVE-2025-52566.