Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessGain write access to slot save directory
-
DeliveryCraft slot file with oversized seq_id
-
ExploitTrigger server slot state restore
-
ExecutionOOB heap read leaks pointer values into logs
-
PersistExtract ASLR-defeating pointer data from logs
-
ImpactChain follow-on memory corruption exploit
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK
1 technique across 1 tactic: Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the attacker to hold write access to the llama.cpp slot save directory - the specific prerequisite captured by AT:P in the CVSS 4.0 vector. The slot save/restore feature must be active, as the vulnerable code path (state_read_meta) is only executed when the server restores previously saved recurrent model state. The timing is also constrained: the malicious slot file must be in place before a state restore operation is triggered. Exploitation is further limited by: (1) the write-access precondition, which rules out unauthenticated remote attackers in correctly hardened deployments where the slot directory is owned exclusively by the service account; (2) the exfiltration channel being server logs, which the attacker must also be able to read to extract useful pointer data; and (3) the impact being a confidentiality/ASLR-defeat primitive with no direct code execution - a follow-on attack step is required to realize full exploitation. |
| Impact | The CVSS 4.0 score of 6.3 (Medium) is broadly consistent with the realistic threat profile. The AT:P metric correctly captures the critical precondition: write access to the slot save directory. In correctly hardened production deployments where the slot directory is owned exclusively by the llama.cpp process account, this precondition materially limits the attack surface to already-compromised users, shared-hosting scenarios, or misconfigured installations. The provided CVSS 4.0 vector uses PR:N, which is in tension with the description's explicit requirement for directory write access; this analyst assesses PR:L as more accurate. The primary real-world risk is as an ASLR-defeat primitive in a multi-stage attack chain rather than a standalone critical flaw: the OOB read yields confidentiality impact only (VC:L), with no direct code execution capability. No EPSS score was provided in the source data, but the precondition requirement makes autonomous or mass scanning exploitation highly unlikely. The VA:L impact in the CVSS 4.0 vector likely reflects potential server instability from reads into unmapped or sensitive heap regions. No KEV listing and no public exploit code were identified, further supporting a medium-priority classification outside of environments with already-weak directory permission controls. |
| Exploit ScenarioDerived | An attacker who has obtained write access to the llama.cpp slot save directory - for example, through a misconfigured shared directory, a co-tenant in a multi-user environment, or a separate vulnerability granting file write - places a crafted slot file containing an oversized seq_id value before a slot restore operation occurs. When the server reads the slot file and processes the unchecked seq_id, it reads memory past the end of the cells array, and the leaked heap contents including pointer values are emitted into server logs. The attacker, who also has log read access, extracts these pointer values to defeat ASLR and uses them to construct a more precise memory corruption exploit targeting the llama.cpp server process. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 06, 2026
Out-of-bounds heap read in llama.cpp's recurrent memory state restore path (builds b5702 through b7653) allows an attacker with write access to the slot save directory to craft a malicious slot file that triggers heap data leakage - including pointer values - into server logs, effectively defeating ASLR protections and enabling multi-stage exploitation. No public exploit has been identified at time of analysis, and the vulnerability is not listed in the CISA KEV catalogue. An upstream fix is available as a commit to the ggml-org/llama.cpp repository, though a tagged released version past the affected build range has not been independently confirmed.
RemediationAI
The upstream fix is available as commit f93c09e2673090b59802f2552848a1cac70598b0 in the ggml-org/llama.cpp repository (https://github.com/ggml-org/llama.cpp/commit/f93c09e2673090b59802f2552848a1cac70598b0); users should build from this commit or any subsequent build past b7653 that incorporates it. A tagged released patched version has not been independently confirmed - the fix exists at commit level only, so users should monitor the repository for a confirmed tagged release. As a compensating control, restrict write permissions on the slot save directory strictly to the llama.cpp server process account using OS-level permissions (e.g., chmod 700 and chown to the service user), which prevents untrusted parties from placing crafted slot files and is the most effective mitigation short of patching. If slot save and restore functionality is not required, disabling it entirely eliminates the vulnerable code path with no functional trade-off for deployments that do not use session persistence. Additional security patches are referenced at https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp is an open-source C/C++ inference engine for large language models widely used both locally and in server deployments. The vulnerability (CWE-125: Out-of-bounds Read) resides in src/llama-memory-recurrent.cpp within the state_read_meta function, which handles restoring recurrent model memory state from disk-persisted slot files. When the server reads a seq_id field from a slot file, the original code validated only that seq_id >= 0, omitting the critical upper-bound check (seq_id < n_seq_max). An oversized seq_id causes array indexing past the end of the allocated cells array in heap memory. The commit diff at f93c09e2673090b59802f2552848a1cac70598b0 confirms the fix: adding (uint32_t) seq_id >= this->n_seq_max restores the bounds check that was apparently commented out as a TODO. No CPE string was provided in the source data; affected versions are identified by EUVD-2026-54285 as build range b5702-b7653 and release 0.17.1.
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
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N
Write access to the slot save directory constitutes low privilege (PR:L) and a specific precondition (AC:H); impact limited to partial heap disclosure (C:L) and potential server instability (A:L).
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
DescriptionCVE.org
llama.cpp builds b5702 through b7653 contain an out-of-bounds read vulnerability in the recurrent memory state restore path that allows attackers with write access to the slot save directory to read memory past the end of the allocated cells array. Attackers can craft a malicious slot file with an oversized seq_id value to trigger an out-of-bounds read that leaks heap data including pointer values into server logs, defeating ASLR protections and facilitating further exploitation.
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.
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add
Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri
Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg
Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge
Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use
Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali
Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict
CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f
Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem
llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,
Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who
Stack-based out-of-bounds write in llama.cpp's ggml-rpc RDMA receive path (builds b8841 through b11865) lets unauthentic
EUVD-2026-54285
GHSA-27j8-r4f8-8v3x
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB