CVE-2026-43629
Received Received - Intake

Heap Buffer Overflow in llama.cpp KV Cache State Restore

Vulnerability report for CVE-2026-43629, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-06

Last updated on: 2026-08-06

Assigner: VulnCheck

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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-06
Last Modified
2026-08-06
Generated
2026-08-07
AI Q&A
2026-08-07
EPSS Evaluated
N/A
NVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
llama_cpp llama_cpp *

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-787 The product writes data past the end, or before the beginning, of the intended buffer.
CWE-190 The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability is a heap buffer overflow in llama.cpp versions b4882 through b9058. It occurs during the KV cache state restore process when the state_read_data() function calculates write size without proper overflow checks. Attackers with write access to the slot_save_path directory can exploit this by crafting malicious state files where cell_count multiplication overflows or exceeds tensor buffer allocation. This allows writing attacker-controlled bytes beyond buffer boundaries, potentially corrupting heap metadata, model weights, or enabling arbitrary code execution through function pointer overwrites.

Detection Guidance

Detecting this vulnerability requires checking for vulnerable versions of llama.cpp (builds b4882 through b9058) and inspecting the slot_save_path directory for malicious state files. Review the version of llama.cpp in use and compare it against the affected builds. Check for unexpected processes or files in the slot_save_path directory that could indicate exploitation attempts.

Impact Analysis

If you use affected versions of llama.cpp, an attacker with write access to the slot_save_path directory could exploit this to corrupt memory, crash the application, or execute arbitrary code. This could lead to data corruption, denial of service, or complete system compromise depending on the context in which llama.cpp is running.

Mitigation Strategies

Upgrade llama.cpp to a version beyond b9058 to address the heap buffer overflow. Restrict write access to the slot_save_path directory to trusted users only. Monitor the directory for unauthorized or suspicious state files. If compromised, restore from a clean backup and investigate potential data corruption or unauthorized access.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-43629. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart