llama.cpp CVE-2024-23605
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious .gguf with overflowing n_kv
-
DeliveryDistribute via model hub or supply chain
-
ExploitVictim downloads and loads model
-
ExecutionTrigger heap overflow in GGUF parser
-
PersistExecute arbitrary code in inference process
-
ImpactPivot to ML pipeline and credentials
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer overflow checks
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires a victim to load an attacker-supplied .gguf model file using a vulnerable llama.cpp build (commit 18c2e17 or any unpatched derivative); this is the UI:R requirement in the CVSS vector. No authentication to any service is needed (PR:N), but the attacker must successfully deliver the malicious .gguf file via a model hub, shared filesystem, supply-chain compromise, or social engineering, and the victim must invoke a llama.cpp tool or downstream wrapper that parses the GGUF header. Limiting factors: the victim system must use a llama.cpp version containing the vulnerable header.n_kv parsing path, and the attacker has no way to trigger parsing without the user (or an automated pipeline) actively loading the file. |
| Impact | The CVSS 3.1 score of 8.8 reflects network attack vector with low complexity, no privileges required, but user interaction needed (AV:N/AC:L/PR:N/UI:R) - the UI:R is the critical limiter, since exploitation requires a user to load the malicious .gguf file. EPSS at 0.15% (35th percentile) is low despite publicly available exploit code, which is consistent with the user-interaction gating: mass automated exploitation is impractical, but targeted social-engineering scenarios (poisoned models on Hugging Face mirrors, supply-chain attacks against ML pipelines) are very plausible. The vulnerability is NOT on the CISA KEV list, so there is no confirmation of active exploitation, and the realistic threat profile is targeted supply-chain compromise against AI/ML developers and inference servers rather than internet-scanning worms. The 'AV:N' rating is somewhat optimistic - delivery is network-capable (download a model file) but execution is local upon parse, so defenders should treat this primarily as a malicious-file/supply-chain risk. |
| Exploit ScenarioDerived | An attacker uploads a backdoored .gguf model file to a public model hub (e.g., a typosquatted or look-alike Hugging Face repository) or distributes it via a compromised CI/CD pipeline targeting ML engineers. When a developer or inference server downloads and loads the model with a vulnerable llama.cpp build, the malicious header.n_kv value triggers the heap overflow during parsing, executing attacker-controlled shellcode in the context of the inference process - which often runs with access to GPU resources, internal model registries, and other sensitive infrastructure. Publicly available exploit code lowers the barrier for adapting this into a targeted supply-chain campaign. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAI
Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a user into loading a maliciously crafted .gguf model file, exploiting a heap-based buffer overflow in the header.n_kv parsing logic at commit 18c2e17. Publicly available exploit code exists, though EPSS rates real-world exploitation probability low at 0.15% (35th percentile), reflecting the user-interaction requirement. The flaw was reported by Cisco Talos and impacts confidentiality, integrity, and availability of any system loading untrusted GGUF models.
RemediationAI
Upstream fix available (commit) per the Cisco Talos disclosure (TALOS-2024-1903); released patched version not independently confirmed from the provided data, so operators should pull the latest llama.cpp main branch past commit 18c2e17 and rebuild, then verify downstream wrappers (llama-cpp-python, Ollama, etc.) have updated to a llama.cpp revision that includes the GGUF parser fix. As a compensating control until patched, restrict .gguf model loading to files from cryptographically verified sources only (signed releases from official Hugging Face repos with known publishers), and avoid loading community-uploaded or unsigned GGUF files; the trade-off is reduced model experimentation flexibility. Network-segment inference workloads so they cannot fetch arbitrary models from the public internet, accepting the operational cost of curating an allowlist of trusted model sources. Refer to the Cisco Talos advisory referenced in the CVE record for the exact commit hash of the fix.
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp is a widely used C/C++ inference engine for running LLaMA-family large language models locally, and GGUF is its native binary model format that encodes tensor data alongside key-value metadata in the file header. The vulnerability sits in the GGUF parser's handling of the header.n_kv field, which declares how many key-value metadata entries follow; CWE-190 (Integer Overflow or Wraparound) indicates that an attacker-controlled count value is used in arithmetic - likely a multiplication for allocation sizing - that wraps around and produces an undersized heap buffer, leading to subsequent out-of-bounds heap writes when the entries are populated. The affected CPE cpe:2.3:a:ggml:llama.cpp covers the upstream ggml-org project, and because GGUF is the de-facto model format consumed by many downstream tools (Ollama, LM Studio, text-generation-webui, llama-cpp-python bindings), the parser code is widely embedded beyond the upstream binary itself.
Know when Llama Cpp gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Primary rating from NVD · only source for this CVE.
CVSS VectorNVD
DescriptionCVE.org
A heap-based buffer overflow vulnerability exists in the GGUF library header.n_kv functionality of llama.cpp Commit 18c2e17. A specially crafted .gguf file can lead to code execution. An attacker can provide a malicious file to trigger this vulnerability.
Executive ViewAI
llama.cpp, a widely-used GGUF machine learning library, contains a remote code execution vulnerability (CVSS 8.8) in model file parsing that allows arbitrary code execution when users load maliciously crafted model files. Organizations deploying llama.cpp to process user-supplied or third-party AI models face potential system compromise and data breach; the risk is elevated because no vendor patch is currently available.
Restrict GGUF model loading to internal, pre-approved sources only; implement file integrity validation (hash verification) before loading any model; require digital signatures from trusted model publishers; air-gap or sandbox systems that must process external models; disable llama.cpp on systems where GGUF processing is not essential. Publicly available exploit code exists, requiring strong preventive controls until patch availability.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)CVE.org
Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add
Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri
Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg
Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge
Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali
Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict
CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f
Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem
llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,
Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who
Stack-based out-of-bounds write in llama.cpp's ggml-rpc RDMA receive path (builds b8841 through b11865) lets unauthentic
Remote code execution in llama.cpp's llama-server (builds b7492 through b9060) allows unauthenticated attackers to run a
NVD
CVE.org
EPSS
GitHub PoC
Exploit-DB