Skip to main content

llama.cpp CVE-2026-43629

| EUVDEUVD-2026-54284 CRITICAL
Integer Overflow or Wraparound (CWE-190)
2026-08-06 disclosure@vulncheck.com GHSA-7p8h-8h8j-472c
9.2
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Obtain write access to slot_save_path directory
  2. Delivery
    Plant crafted state file with overflowing cell_count
  3. Exploit
    Trigger KV cache slot restore via server
  4. Execution
    state_read_data writes past tensor buffer
  5. Persist
    Corrupt heap metadata / overwrite function pointer
  6. Impact
    Execute arbitrary code in server process

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer overflow checks
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the llama.cpp server be run with the KV cache slot save/restore feature enabled (the --slot-save-path option set) AND that the attacker can place a crafted state file into that slot_save_path directory, then cause the server to restore it. Limiting factors: the feature is not enabled by default, the malicious file must reach the configured directory (requiring filesystem write access or an upload path into it), and only the vulnerable build range b4882 through b9058 is affected. The CVSS 4.0 AT:P attack-requirement flag reflects this file-placement precondition, so this is not remote-unauthenticated exploitation of a default configuration despite the network attack vector.

Impact

The published CVSS 4.0 score of 9.2 (AV:N/AC:L/AT:P/PR:N/UI:N with High confidentiality, integrity and availability impact) rates this critical, but the AT:P flag and the description both indicate a real precondition: the attacker must be able to write a malicious state file into the slot_save_path directory, which is not a purely remote-unauthenticated primitive. This tension should be verified - the network attack vector likely reflects that the restore can be triggered via the server's /slots API, while the malicious file must first reach the filesystem. There is no EPSS score, no KEV listing, and no confirmed public POC provided, so despite the high CVSS this reads as a high-impact-but-conditionally-exploitable issue rather than a mass-exploitation threat. Real-world priority is highest for deployments that expose the slot save/restore feature and allow untrusted input into the save directory; hardened deployments (feature disabled, directory not attacker-writable) face substantially lower practical risk.

Exploit ScenarioDerived

An attacker who has gained the ability to write files into the server's slot_save_path directory (for example via a shared volume, an upload path, or a compromised co-located process) plants a crafted state file with a cell_count value engineered to overflow the size calculation. When the llama.cpp server restores that slot - triggered locally or through its /slots restore API - state_read_data() copies attacker-controlled bytes past the tensor buffer, corrupting heap memory and, with a suitable function-pointer overwrite, executing attacker code in the server process. No public POC is available at time of analysis.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
No patch listed yet 0.5% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Aug 06, 2026

Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who can place a crafted state file in the configured slot_save_path corrupt heap memory and potentially achieve arbitrary code execution. The flaw lives in state_read_data(), which computes a write size from an attacker-influenced cell_count without integer-overflow checking, so a malicious slot file can write past the tensor buffer. No public exploit identified at time of analysis and it is not listed in CISA KEV; the only reference is a third-party security-patches repository, so exploitation currently appears theoretical rather than active.

RemediationAI

Upgrade to a llama.cpp build newer than b9058 once an official fixed release is confirmed upstream; the fix status here is Upstream fix available (PR/commit) via the third-party repository at https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches, and a released patched version is not independently confirmed, so validate the exact fixed build against ggml-org/llama.cpp before relying on it. As compensating controls until patched: disable the slot save/restore feature by not setting --slot-save-path (trade-off: loses KV cache persistence across restarts); if the feature is required, restrict filesystem permissions on the slot_save_path directory so only trusted local processes can create files there and no untrusted user or network-exposed process can write to it; and place the llama.cpp server behind authentication and network restrictions so the /slots restore endpoint cannot be invoked by untrusted clients. Each control reduces the persistence feature's usefulness but does not alter model inference behavior.

Affected VersionsENISA

llama.cpp 0.16.1 ≤0.17.1
llama.cpp b4882 ≤b9058

Affected Packages

euvd llama_cpp no fix

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 the widely used C/C++ inference engine for GGUF-format LLMs, and its bundled HTTP server supports saving and restoring per-slot KV cache state to disk (the --slot-save-path feature) so conversations can be persisted and reloaded. The vulnerability is a CWE-190 integer overflow that becomes a heap buffer overflow: state_read_data() reads a cell_count value from the serialized state file and multiplies it to determine how many bytes to copy into a pre-allocated tensor buffer, but never validates that the product fits within the allocation. Because the KV cache buffers are heap-allocated contiguous tensors, an over-large or overflowing cell_count causes attacker-controlled bytes to be written beyond the buffer, threatening adjacent heap metadata, model weight tensors, or function pointers.

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

Vendor (vulncheck) PRIMARY 9.2 CRITICAL
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 7.0 HIGH

Exploitation needs write access to the slot_save_path directory (PR:L) plus a crafted-file precondition (AC:H); a successful overflow yields full code execution, so C/I/A are all High.

3.1 AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
4.0 AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE HIGH
Red Hat 8.1 HIGH

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

llama.cpp builds b4882 through b9058 contain a heap buffer overflow vulnerability in the KV cache state restore path where the state_read_data() function computes write size without overflow checking, allowing attackers with write access to the slot_save_path directory to corrupt heap memory. Attackers can craft malicious state files where cell_count multiplication overflows or exceeds tensor buffer allocation to write attacker-controlled bytes past buffer boundaries, potentially resulting in heap metadata corruption, model weight corruption, or arbitrary code execution via function pointer overwrite.

Executive ViewAI

Why It Matters

A critical heap buffer overflow in llama.cpp server (builds b4882-b9058) can enable arbitrary code execution through crafted state files; no public exploit has been identified at this time. No vendor patch is currently available, leaving affected organizations exposed to potential system compromise. Immediate action is required to either upgrade to an unaffected version or implement compensating controls.

Business Impact: Severe
Compensating Controls

Restrict filesystem permissions on the slot_save_path directory to prevent unauthorized write access; disable the KV cache state-restore feature if not required for operations; implement filesystem monitoring and alerting for the slot directory; isolate affected systems from untrusted networks; use air-gapping for critical systems until upgrade is completed. These mitigations reduce exploitation risk but do not eliminate it pending vendor patch or version upgrade.

Threat Intelligence Overview

EPSS Score
0.5%
Top 59% exploitable
Prevalence
High
extremely popular local LLM inference engine; vulnerable slot-save feature is optional
Data Quality
9 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub VulDB

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 CRITICAL
CISA KEV No
Public POC No
EPSS 0.5%
Patch available No
Active threat No
Deciding rule
CRITICAL severity
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
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
Very High
Technical Impact
Total

Priority Score

47
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +46
PoC: 0
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.

Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

CVE-2024-42479 CRITICAL POC
10.0 Aug 12

Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add

CVE-2024-21802 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri

CVE-2026-21869 HIGH POC
8.8 Jan 08

Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg

CVE-2024-21825 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge

CVE-2024-23605 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use

CVE-2024-23496 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali

CVE-2024-21836 HIGH POC
8.8 Feb 26

Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict

CVE-2025-52566 HIGH POC
8.6 Jun 24

CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f

CVE-2026-34159 CRITICAL
9.8 Apr 01

Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem

CVE-2024-42478 MEDIUM POC
5.3 Aug 12

llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,

CVE-2026-118375 CRITICAL
9.2 Oct 28

Stack-based out-of-bounds write in llama.cpp's ggml-rpc RDMA receive path (builds b8841 through b11865) lets unauthentic

CVE-2026-43631 CRITICAL
9.2 Aug 06

Remote code execution in llama.cpp's llama-server (builds b7492 through b9060) allows unauthenticated attackers to run a

Vendor StatusVendor

SUSE

Severity: Important

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