CVE-2025-52566 llama.cpp tokenizer signed vs. unsigned heap overflow

High 8.6 Published Updated

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.

Weakness: CWE-195, CWE-119

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.

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.

Is CVE-2025-52566 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free