CVE-2026-43629: llama.cpp b4882–b9058 Buffer Overflow in KV Cache State Restore
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.
Security readout for executives and security teams
Plain-English summary
A flaw in llama.cpp’s saved-state restoration can corrupt memory when a malicious state file is loaded. Exploitation requires an attacker to influence files in the configured slot-save directory. Successful abuse could crash the service, corrupt model data, or potentially execute code with the service’s privileges.
Executive priority
Treat affected, state-restoring deployments as an urgent remediation priority, especially when untrusted workloads can influence saved files. Immediately restrict directory access and identify exposed instances. Because the supplied material does not name an authoritative fixed release, require engineering to validate the referenced patches and monitor official ggml-org guidance before closing the issue.
Technical view
The state_read_data() path reportedly calculates a KV-cache write size without safely handling multiplication overflow or allocation bounds. A crafted cell count can make the write exceed the destination tensor buffer, causing a heap out-of-bounds write. Reported consequences include heap metadata or model-weight corruption and potential control-flow compromise.
Likely exposure
Exposure is highest where affected llama.cpp builds restore KV-cache states and untrusted users, workloads, or compromised processes can write to slot_save_path. Systems without state restoration or with a directory writable only by a tightly controlled service identity have a reduced attack surface. The supplied sources do not establish how commonly this configuration is deployed.
Exploitation context
The supplied record is not marked as CISA KEV, and the source bundle provides no evidence of active exploitation. Exploitation has an important precondition: attacker influence over saved-state files. Network reachability alone does not prove exploitability; assess whether application workflows permit remote users to create or replace those files.
Researcher notes
The stated affected scope is not fully consistent: the title says builds b4882 through b9058, while the affected entry lists b4882 and 0.16.1. Confirm exact build provenance rather than relying only on semantic versions. Validate integer-overflow checks and destination-buffer bounds in the restore path without testing against production systems.
Mitigation direction
Restrict slot_save_path writes to the minimum trusted service identity.
Disable KV-cache state restoration where it is not operationally required.
Review and apply the referenced security patches after confirming build compatibility.
Run llama.cpp with least privilege and isolate it from sensitive files and services.
Check ggml-org guidance for an authoritative fixed version or additional mitigation.
Validation and detection
Inventory llama.cpp build identifiers in applications, containers, and bundled binaries.
Determine whether KV-cache state saving and restoration are enabled.
Review slot_save_path ownership, permissions, mounts, and all file-producing workflows.
Identify whether remote or untrusted workloads can create or replace restored state files.
Confirm the deployed build contains the applicable bounds and integer-overflow protections.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-190: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
3Timeline events
1ADP providers
3Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-190 · source CWE mapping
Integer Overflow or Wraparound
Integer Overflow or Wraparound represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Out-of-bounds Write represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.