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: < 1% Very Low
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

Fri, 14 Aug 2026 17:15:00 +0000

Type Values Removed Values Added
First Time appeared Ggml
Ggml llama.cpp
CPEs cpe:2.3:a:ggml:llama.cpp:*:*:*:*:*:*:*:*
Vendors & Products Ggml
Ggml llama.cpp

Thu, 13 Aug 2026 12:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Fri, 07 Aug 2026 19:15:00 +0000


Fri, 07 Aug 2026 18:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Fri, 07 Aug 2026 02:45:00 +0000

Type Values Removed Values Added
First Time appeared Ggml-org
Ggml-org llama.cpp
Vendors & Products Ggml-org
Ggml-org llama.cpp

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

Ggml Llama.cpp
Ggml-org Llama.cpp
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-14T16:49:54.546Z

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

Link: CVE-2026-43629

cve-icon Vulnrichment

Updated: 2026-08-07T15:52:03.276Z

cve-icon NVD

Status : Received

Published: 2026-08-06T22:17:05.917

Modified: 2026-08-07T19:17:43.660

Link: CVE-2026-43629

cve-icon Redhat

Severity : Important

Publid Date: 2026-08-06T15:48:41Z

Links: CVE-2026-43629 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-07T02:30:05Z

Weaknesses