Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessTrigger concurrent bench_1model() and free_1context() calls
-
DeliveryWin race freeing llama_context while in use
-
ExploitHeap spray freed region with fake vtable payload
-
ExecutionOverwrite vtable pointer at llama_batch_allocr offset +0x30
-
Persistllama_batch_allocr::clear() dispatches to attacker-controlled pointer
-
ImpactExecute arbitrary code within Android app process
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Concurrency control, locking
MITRE ATT&CK
1 technique across 1 tactic: Privilege Escalation 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 target Android device running an application built with llama.cpp JNI wrapper builds b1886-b7445. The application must invoke both |
| Impact | The CVSS 4.0 score of 7.3 (AV:L/AC:H/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H) accurately reflects a constrained but impactful vulnerability. AV:L confirms the attack is bounded to local Android device context rather than a network-reachable endpoint, substantially limiting the realistic attacker population. AC:H reflects the genuine difficulty of reliably winning a race condition and achieving deterministic heap layout for vtable hijacking against Android runtimes that enforce ASLR and, on ARMv9 devices, hardware memory tagging (MTE). PR:N is consistent with the JNI layer being accessible to any thread within the application process without requiring elevated Android permissions. UI:P (user interaction required) further narrows the exploitation window to moments when the victim triggers a benchmark operation. No EPSS data was provided; no CISA KEV listing confirms active exploitation, placing this in the category of a serious but currently theoretical threat. Real-world priority is highest for Android applications that invoke both benchmarking and context-management JNI calls concurrently from multiple threads; single-threaded deployments are not exposed. |
| Exploit ScenarioDerived | An attacker with the ability to influence thread scheduling in an Android application using a vulnerable llama.cpp build triggers |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 06, 2026
Remote code execution is achievable in llama.cpp's LLaMA-Android JNI wrapper (builds b1886 through b7445) by exploiting a race condition use-after-free between bench_1model() and free_1context(), which share the llama_context heap object without any synchronization primitive. An attacker who wins the race can perform a heap spray with a crafted fake vtable, overwriting the vtable pointer at offset +0x30 in llama_batch_allocr so that clear() dispatches to attacker-controlled memory, achieving code execution within the Android application process. No active exploitation is confirmed (not in CISA KEV), and no public exploit code has been identified at time of analysis, though the fully documented vtable offset and exploitation technique substantially lower the development barrier for capable researchers.
RemediationAI
Upgrade to llama.cpp build b7446 or later, the vendor-released patch available at https://github.com/ggml-org/llama.cpp/releases/tag/b7446, which incorporates upstream commit 5c0d18881e0e9794c96b2602736b758bac9d9388. Community-maintained security patches are also referenced at https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches for teams tracking alternative patch channels. If immediate upgrade is not feasible, serialize all JNI calls through a single-threaded executor - for example, a Kotlin coroutine dispatcher with concurrency limited to 1 - to eliminate concurrent access to bench_1model() and free_1context(); this closes the race window but prevents simultaneous inference and benchmarking, which may reduce throughput in multi-model Android applications. Do not rely on application-level guards alone without library-level synchronization, as other call paths may independently reach the same unsynchronized context.
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
CWE-362 (Concurrent Execution Using Shared Resource with Improper Synchronization) is the root cause: two JNI-exported functions, bench_1model() and free_1context(), both operate on the same llama_context C++ heap object without a mutex, memory barrier, or any other synchronization. The Java Native Interface (JNI) layer bridges Kotlin or Java Android application code to llama.cpp's native C++ inference engine; because the Android JNI runtime allows multiple Java threads to invoke native functions concurrently, Thread A executing bench_1model() can still hold a live pointer to llama_context while Thread B's free_1context() deallocates it, producing a classic use-after-free (CWE-416 overlaps). The subsequent exploitation technique - heap spray to reclaim the freed region with a fake vtable, then hijack the C++ virtual dispatch in llama_batch_allocr::clear() at object offset +0x30 - is a well-documented C++ vtable hijacking pattern. The patch is captured in upstream commit 5c0d18881e0e9794c96b2602736b758bac9d9388 and released as build b7446.
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:H/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Local vector for Android JNI-scoped attack; high complexity reflects race-win timing and heap spray precision required; no privileges needed, but user must trigger benchmark path.
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
DescriptionCVE.org
llama.cpp builds b1886 through b7445 contain a race condition use-after-free vulnerability in the LLaMA-Android JNI wrapper where bench_1model() and free_1context() lack synchronization, allowing Thread A to operate on freed memory while Thread B concurrently frees the llama_context. Attackers can exploit this by performing heap spray with attacker-controlled data containing a fake vtable to hijack the vtable pointer at offset +0x30, causing llama_batch_allocr::clear() to dereference arbitrary memory and achieve remote code execution.
Executive ViewAI
llama.cpp's LLaMA-Android component (builds b1886-b7445) contains a remote code execution vulnerability in its JNI wrapper that could allow attackers to execute arbitrary code within Android applications using this library. Organizations deploying these affected builds face risk of application compromise and unauthorized access to sensitive user data.
No vendor-released patch identified at time of analysis. Interim mitigations include: restricting concurrent access patterns in affected applications to minimize race condition exposure, disabling benchmark and context management functionality if not core to operations, and implementing code integrity verification and runtime anomaly detection on affected Android applications. Upgrade to llama.cpp builds beyond b7445 once testing confirms compatibility.
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
Race conditions occur when multiple concurrent requests exploit the brief time gap between checking a condition and acting upon it (TOCTOU - Time of Check, Time of Use).
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
Remote code execution in llama.cpp's llama-server (builds b7492 through b9060) allows unauthenticated attackers to run a
EUVD-2026-54280
GHSA-vfpq-2xx5-4vrv
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB