Skip to main content

Llama.Cpp CVE-2025-52566

| EUVDEUVD-2025-19074 HIGH
Buffer Overflow (CWE-119)
2025-06-24 security-advisories@github.com
8.6
CVSS 3.1 · GitHub Advisory
View

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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

llama.cpp < b5721

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

GitHub Advisory PRIMARY 8.6 HIGH
AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
Ubuntu MEDIUM
SUSE HIGH

Primary rating from GitHub Advisory.

CVSS VectorGitHub Advisory

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Patch released
Mar 15, 2026 - 22:36 nvd
Patch available
PoC Detected
Aug 27, 2025 - 14:01 vuln.today
Public exploit code
CVE Published
Jun 24, 2025 - 04:15 nvd
HIGH 8.6

DescriptionGitHub 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

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.1%
Top 80% exploitable
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Small
Automatable· derived
No
Human Impact
High

Priority Score

63
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +43
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

Vendor StatusVendor

Ubuntu

Priority: Medium
llama.cpp
Release Status Version
jammy DNE -
noble DNE -
oracular DNE -
plucky DNE -
upstream needs-triage -
questing needs-triage -

Debian

Bug #1108368
llama.cpp
Release Status Fixed Version Urgency
sid fixed 8064+dfsg-2 -
(unstable) fixed 5760+dfsg-1 -

SUSE

Severity: High

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy