{
  "affected": [
    {
      "ranges": [
        {
          "database_specific": {
            "cpe": "cpe:2.3:a:ggml:llama.cpp:*:*:*:*:*:*:*:*",
            "extracted_events": [
              {
                "introduced": "b4882"
              },
              {
                "last_affected": "b9058"
              }
            ],
            "source": "CPE_RANGE"
          },
          "events": [
            {
              "introduced": "be7c3034108473beda214fd1d7c98fd6a7a3bdf5"
            },
            {
              "last_affected": "803627f121dca7d4ec5166178d89398f20d288c0"
            }
          ],
          "repo": "https://github.com/ggml-org/llama.cpp",
          "type": "GIT"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "VulnCheck",
    "cwe_ids": [
      "CWE-190",
      "CWE-787"
    ],
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/43xxx/CVE-2026-43629.json",
    "unresolved_ranges": [
      {
        "extracted_events": [
          {
            "introduced": "b4882"
          },
          {
            "last_affected": "b9058"
          },
          {
            "introduced": "0.16.1"
          },
          {
            "last_affected": "0.17.1"
          }
        ],
        "source": "AFFECTED_FIELD"
      },
      {
        "extracted_events": [
          {
            "introduced": "b4882"
          },
          {
            "last_affected": "b9058"
          },
          {
            "introduced": "0.16.1"
          },
          {
            "last_affected": "0.17.1"
          }
        ],
        "source": "CPE_FIELD"
      },
      {
        "extracted_events": [
          {
            "introduced": "b4882"
          },
          {
            "fixed": "b9058"
          }
        ],
        "source": "DESCRIPTION"
      }
    ]
  },
  "details": "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.",
  "id": "CVE-2026-43629",
  "modified": "2026-09-23T03:30:20.117162955Z",
  "published": "2026-08-06T15:48:41.246Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/43xxx/CVE-2026-43629.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-43629"
    },
    {
      "type": "ADVISORY",
      "url": "https://www.vulncheck.com/advisories/llama-cpp-b4882-b9058-buffer-overflow-in-kv-cache-state-restore"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches"
    }
  ],
  "schema_version": "1.9.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "llama.cpp b4882–b9058 Buffer Overflow in KV Cache State Restore"
}