Description
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.
Published: 2026-08-06
Score: 9.2 Critical
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

llama.cpp versions built between commits b4882 and b9058 contain a heap buffer overflow in the KV cache state restore path. The vulnerability resides in the state_read_data() function, which multiplies cell_count without checking for overflow, allowing an attacker to craft a malicious state file that overflows the heap buffer. This can corrupt heap metadata, corrupt model weights, or overwrite a function pointer, potentially leading to arbitrary code execution. The weakness aligns with CWE‑190 (Integer Overflow) and CWE‑787 (Out‑of‑Bounds Write).

Affected Systems

Affected: the open‑source ggml‑org llama.cpp project. The problem exists in builds generated by source commits b4882 through b9058. No explicit release numbers are listed, so any binary built from that source range that uses the slot_save_path directory is considered vulnerable.

Risk and Exploitability

The CVSS score is 9.2, indicating critical severity. No EPSS data is available, and the issue is not listed in the CISA KEV catalog. Exploitation requires write access to the slot_save_path directory, so the attack surface is primarily local or confined to privileged users who can place state files. Once the overflow is triggered, the attacker may write arbitrary bytes past the intended buffer, potentially achieving code execution by corrupting heap structures or overwriting function pointers.

Generated by OpenCVE AI on August 7, 2026 at 01:13 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update llama.cpp to a version after commit b9058 or apply the security patch found at the provided GitHub repository.
  • Restrict write permissions on the slot_save_path directory so that only trusted users can create or modify state files.
  • Run the llama.cpp application with the lowest required privileges to limit the impact of potential exploitation.

Generated by OpenCVE AI on August 7, 2026 at 01:13 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 06 Aug 2026 22:15:00 +0000

Type Values Removed Values Added
Description 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.
Title llama.cpp b4882–b9058 Buffer Overflow in KV Cache State Restore
Weaknesses CWE-190
CWE-787
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.2, 'vector': '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'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-06T15:48:41.246Z

Reserved: 2026-05-01T18:22:45.641Z

Link: CVE-2026-43629

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-07T01:15:05Z

Weaknesses