---
id: "CVE-2024-58399"
kind: "vulnerability"
aliases: ["CVE-2024-58399"]
title: "llama.cpp: crafted GGUF model file reads memory outside the model"
severity: "medium"
cvss: 6.9
epss: null
exploited: false
status: "open"
category: "ai-tooling"
products: []
ecosystems: []
tags: ["ai-tooling", "ggml", "llama.cpp", "local-llm", "self-hosted"]
not_affected_if: ["pinned-newer-build", "trusted-models-only"]
published_at: "2026-10-27T01:19:02+00:00"
first_seen_at: "2026-10-27T01:34:33+00:00"
updated_at: "2026-10-27T01:36:24+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-58399", "first_seen_at": "2026-10-27T01:34:33+00:00"}]
---

# llama.cpp: crafted GGUF model file reads memory outside the model

llama.cpp versions before b2731 have an out-of-bounds read in llama_model_loader when a GGUF model file contains crafted tensor offsets. A malicious model file can crash the process or load adjacent process memory as model weights.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the llama.cpp build tag or commit in use, for example by running `llama-cli --version` or looking at the build metadata, and compare it with `b2731`.
- Find any model loading path that accepts GGUF files from users or untrusted sources.

## Fix

- Upgrade llama.cpp to `b2731` or later.
- Only load GGUF models from trusted sources until the upgrade is done.

## Timeline

- 2026-10-27T01:34:33+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2024-58399

## From the sources

llama.cpp before b2731 contains an out-of-bounds read vulnerability in llama_model_loader that allows attackers to read memory outside the mapped model file via crafted GGUF tensor offsets. Attackers can supply a crafted or truncated GGUF model file with arbitrary 64-bit tensor offsets to crash the process or load adjacent process memory as model weights.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
