Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply crafted n_tokens/n_seq_max parameters
-
DeliveryInvoke llama_batch_init() in vulnerable build
-
ExploitInteger overflow wraps malloc() size past INT32_MAX
-
ExecutionHeap buffer under-allocated
-
PersistBatch write operations exceed buffer boundary
-
ImpactHeap corruption enables arbitrary code execution
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 local access to an environment running a vulnerable llama.cpp build (b1283 through b9058 / versions 0.4.0 to 0.17.1) - the CVSS 4.0 AV:L metric confirms this is not a remote-network-reachable vulnerability in its base form. Passive user interaction is required (UI:P): the victim process must invoke llama_batch_init() with attacker-influenced parameter values, meaning the attacker must control or influence the n_tokens or n_seq_max arguments - achievable via malicious model files, crafted API inputs to an inference server accepting external requests, or direct local code execution. No elevated privileges are required (PR:N); standard user-level execution of a llama.cpp-backed application suffices. Exploitation is NOT possible against systems running builds earlier than b1283 or later than b9058, nor against semantic versions outside 0.4.0 to 0.17.1. The local attack vector substantially limits opportunistic mass exploitation but does not protect inference servers that expose their batch API to untrusted callers or that load third-party model weights. |
| Impact | The CVSS 4.0 base score of 8.5 reflects the combination of a local attack vector (AV:L), low complexity (AC:L), no privilege requirement (PR:N), and high impact across confidentiality, integrity, and availability - calibrated downward from theoretical maximum by the required passive user interaction (UI:P). Real-world risk is meaningful but gated by the local attack vector: an attacker must either have local code execution in the same environment or must be able to influence the batch parameters passed to llama_batch_init() through a higher-level application surface (e.g., a malicious model file or crafted API request to an inference server). EPSS data is not available in the provided intelligence; exploitation probability must therefore be inferred from structural signals. The heap corruption primitive producing an RCE-class outcome elevates this above typical integer overflow advisories. No CISA KEV listing and no identified public POC reduce immediate operational urgency, but the broad deployment of llama.cpp across both interactive AI tooling and production inference infrastructure means the blast radius of a working exploit would be substantial. The absence of an explicit released patch version - only a GitHub security patches reference - is a gap that defenders should resolve before assuming a safe upgrade path exists. |
| Exploit ScenarioDerived | An attacker provides a specially crafted model configuration or batch request to an application using a vulnerable llama.cpp build - for example, submitting a request to a local inference server with n_tokens and n_seq_max values chosen so their product exceeds INT32_MAX. The call to malloc() receives the wrapped (underflowed) size, allocates a small heap buffer, and the subsequent batch write operations overwrite adjacent heap regions, corrupting allocator metadata or function pointers. With a refined heap grooming technique, this corruption can redirect execution to attacker-controlled code within the host process. No public proof-of-concept has been identified at time of analysis, but the overflow is structurally straightforward to reproduce once the triggering parameter values are known. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 06, 2026
Integer overflow in llama.cpp's llama_batch_init() function across builds b1283 through b9058 enables heap corruption via unchecked multiplicative arithmetic in malloc() size calculations - when computed allocation sizes wrap past INT32_MAX, the resulting under-sized heap buffer is overwritten by subsequent batch operations, creating a credible path to arbitrary code execution in the context of the host process. The vulnerability affects versions 0.4.0 through 0.17.1 and any application embedding the affected build range of the library. No public exploit code has been identified at time of analysis and the CVE is not listed in the CISA KEV catalog, but the heap corruption primitive paired with the RCE tag warrants expedited patching in production AI inference pipelines.
RemediationAI
Upgrade llama.cpp to a build above b9058 (semantic version above 0.17.1) once a formally released patched version is confirmed - upstream fix commits are referenced at https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches, but a tagged release version has not been independently confirmed from the available data; verify the fix is included in a stable release before deploying. If an immediate upgrade is not feasible, the primary compensating control is to restrict who or what can supply batch parameters to llama_batch_init(): for inference server deployments, enforce authenticated and authorized access to the batch API endpoint and reject untrusted or externally sourced model files, which may carry parameter configurations that trigger the overflow. Sandboxing the inference process (e.g., running llama.cpp inside a container with seccomp/AppArmor profiles) limits the impact of heap corruption to the sandbox rather than the host. Note that sandboxing does not prevent exploitation - it only contains post-exploitation impact. Do not treat the local attack vector as a strong mitigating factor if the deployment exposes an inference API or accepts third-party model inputs.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
llama.cpp (CWE-190: Integer Overflow or Wraparound) is the dominant open-source C/C++ library for quantized large-language-model inference, providing the core inference engine for downstream tools such as Ollama, LM Studio, and numerous embedded AI applications. The vulnerable function llama_batch_init() constructs batch data structures sized by multiplying parameters such as n_tokens and n_seq_max; because these multiplications are performed in 32-bit integer space without bounds checking, sufficiently large attacker-controlled values wrap around INT32_MAX and produce a malloc() size argument far smaller than the data subsequently written into the buffer. CPE-identifiable affected scope is llama.cpp builds b1283 through b9058 (semantic versions 0.4.0 to 0.17.1). The root cause is a classic integer overflow-to-heap-underallocation pattern (CWE-190), where the allocation succeeds but the write primitive derived from the original un-overflowed parameter count then corrupts adjacent heap metadata or data, enabling control-flow hijack.
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
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Local vector and required user interaction (invoking vulnerable code with attacker-controlled parameters) confirmed; no privileges needed; full heap corruption impacts all three pillars.
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
DescriptionCVE.org
llama.cpp builds b1283 through b9058 contain an integer overflow vulnerability in the llama_batch_init() function where unchecked multiplications in malloc() calls can wrap past INT32_MAX when computing allocation sizes. Attackers can pass specially crafted parameters to trigger integer overflow, causing heap corruption and potentially achieving arbitrary code execution through subsequent batch operations that write past allocated buffer boundaries.
Executive ViewAI
Integer overflow in llama.cpp versions 0.4.0-0.17.1 enables heap corruption leading to arbitrary code execution in production AI inference systems; no public exploit identified at time of analysis. Organizations deploying affected versions risk complete compromise of inference infrastructure and exposure of sensitive model data through malicious batch submissions. Immediate isolation and remediation within 24 hours is critical given the code execution severity.
No vendor-released patch identified at time of analysis. Interim mitigations: implement strict input validation and batch size limits to prevent integer overflow; restrict batch processing to authenticated, trusted sources only; isolate affected services to restricted networks with egress filtering; disable batch processing if operationally feasible; monitor for process crashes, memory corruption indicators, or unauthorized code execution; consider temporary rollback to llama.cpp versions prior to 0.4.0 if compatible with current deployments.
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
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.
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 (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use
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
EUVD-2026-54281
GHSA-6gxr-4p8w-gxc9
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB