Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, buffer size validation
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Impact | CVSS 8.6 (High) with vector CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H indicates severe exploitability: Attack Vector is Local (requires attacker or malicious user to supply input to a llama.cpp-based application), Attack Complexity is Low (no special conditions needed), Privilege escalation is not required, and the scope is Changed with High impact across confidentiality, integrity, and availability. The UI:R (User Interaction Required) element requires a user to process the malicious tokenized text, but in many inference scenarios, this is automatic. Real-world risk is substantial because: (1) llama.cpp is widely used in AI/ML applications, local services, and chatbot backends; (2) the attack surface includes any application accepting user text for LLM inference; (3) heap overflow can lead to arbitrary code execution; (4) the patch exists but requires user adoption. However, without EPSS score data, KEV status confirmation, or public POC availability, the actual exploitation likelihood in the wild is not yet quantifiable. The vulnerability should be prioritized for patching in production environments, especially those exposing llama.cpp-based inference endpoints to untrusted input, as the combination of high CVSS, local attack vector with minimal privileges, and complete impact coverage makes this a critical issue despite the local+UI requirement. |
| Exploit ScenarioDerived | An attacker with local access to a machine running a llama.cpp-based application (e.g., a local AI assistant, RAG chatbot, or inference service) crafts a malicious text input designed to trigger the signed/unsigned integer overflow during tokenization. The attacker submits this text through the application's normal inference interface (chat input, API endpoint, file upload for processing). When llama.cpp's tokenizer processes this input, the integer overflow causes a miscalculation of the buffer size needed for token copying, resulting in a heap buffer overflow. This overflow can overwrite adjacent heap memory, potentially corrupting internal data structures or enabling arbitrary code execution. The attack succeeds because: (1) no special authentication required (PR:N); (2) the attack vector is local, exploitable by any user on the system or via a local service; (3) user interaction is automatic in most inference scenarios; (4) the overflow occurs in the core tokenization path called for every inference. If no POC is publicly available yet, one would likely be released once the CVE gains wider attention, making patch adoption critical. The impact is complete system compromise if code execution is achieved. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 15, 2026
CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize function) that enables heap buffer overflow during text tokenization. This affects all versions of llama.cpp prior to b5721, and attackers can trigger the vulnerability with specially crafted text input during the inference process, potentially achieving code execution with high confidentiality, integrity, and availability impact. The vulnerability requires local access and user interaction but has a high CVSS score of 8.6; KEV status and active exploitation data are not currently available, but the patch exists in version b5721.
RemediationAI
Immediate remediation: Upgrade llama.cpp to version b5721 or later, which contains the patch for the signed vs. unsigned integer overflow. For development environments: pull the latest code from the llama.cpp main branch (commit b5721 or later) and rebuild. For production deployments: (1) Update to patched version immediately; (2) If immediate patching is not feasible, implement input validation/sanitization at the application layer before passing text to llama.cpp tokenizer (e.g., limit input size, reject unusual character sequences, validate token counts); (3) Reduce attack surface by restricting who can submit inference requests to llama.cpp services; (4) Run llama.cpp processes with minimal privileges and in sandboxed/containerized environments to limit impact of potential code execution. Long-term: Monitor the official llama.cpp repository (github.com/ggerganov/llama.cpp) for security updates and establish a patching cadence for AI/ML dependencies.
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp is a C/C++ implementation for inference of Large Language Models (LLMs), designed to run efficiently on consumer hardware. The vulnerability exists in src/llama-vocab.cpp at line 3036 within the tokenizer implementation. The root cause is a signed vs. unsigned integer overflow (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) occurring during token copying size comparisons. When tokenizing user-supplied text, the vulnerable code miscalculates buffer sizes due to type confusion between signed and unsigned integers, allowing writes beyond allocated heap memory. This is a classic buffer overflow scenario where the tokenizer processes input tokens and fails to properly validate allocation boundaries before copying token data. The vulnerable code path is triggered during normal LLM inference when processing text tokens, making it reachable from any application using llama.cpp for inference tasks.
Know when Llama.Cpp gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
Lifecycle Timeline
3DescriptionGitHub Advisory
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.
Executive ViewAI
CVE-2025-52566 is a high-severity heap overflow vulnerability in llama.cpp that could allow attackers to crash or potentially execute code through malicious text input to LLM inference systems. Organizations deploying llama.cpp for AI/ML applications should prioritize patching immediately, as public exploits exist and the attack requires only crafted text input.
Apply vendor patch. If immediate patching is infeasible: implement input validation/sanitization on text submitted to llama.cpp tokenizer; restrict API access to trusted internal users only; disable public-facing LLM inference endpoints until patched; monitor for suspicious tokenization requests or application crashes.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
A heap overflow occurs when a program writes data beyond the bounds of a buffer allocated in the heap memory region.
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg
A buffer overflow vulnerability in llama.cpp (CVSS 8.8). High severity vulnerability requiring prompt remediation. Vendo
Same weakness CWE-119 – Buffer Overflow
View allSame technique Buffer Overflow
View allVendor StatusVendor
Ubuntu
Priority: Medium| Release | Status | Version |
|---|---|---|
| jammy | DNE | - |
| noble | DNE | - |
| oracular | DNE | - |
| plucky | DNE | - |
| upstream | needs-triage | - |
| questing | needs-triage | - |
Debian
Bug #1108368| Release | Status | Fixed Version | Urgency |
|---|---|---|---|
| sid | fixed | 8064+dfsg-2 | - |
| (unstable) | fixed | 5760+dfsg-1 | - |
EUVD-2025-19074
NVD
CVE.org
EPSS
GitHub
Exploit-DB