Skip to main content

llama.cpp EUVDEUVD-2026-54280

| CVE-2026-70640 HIGH
Race Condition (CWE-362)
2026-08-06 disclosure@vulncheck.com GHSA-vfpq-2xx5-4vrv
7.3
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Trigger concurrent bench_1model() and free_1context() calls
  2. Delivery
    Win race freeing llama_context while in use
  3. Exploit
    Heap spray freed region with fake vtable payload
  4. Execution
    Overwrite vtable pointer at llama_batch_allocr offset +0x30
  5. Persist
    llama_batch_allocr::clear() dispatches to attacker-controlled pointer
  6. Impact
    Execute 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 bench_1model() and free_1context() from separate concurrent threads - applications that call these functions exclusively from a single thread are not exploitable via this race condition. The attacker must be able to influence the timing of concurrent JNI calls, either by controlling application logic or through inter-process means on the same device. User interaction is required per the CVSS UI:P rating, meaning the victim must trigger the benchmarking code path. Exploitation is further constrained by CVSS AC:H: the attacker must reliably win the race window AND achieve deterministic heap layout for vtable hijacking, which Android mitigations including ASLR and hardware memory tagging on ARMv9 devices complicate considerably. The CVSS PR:N rating confirms no elevated Android permissions are required once the concurrent call condition is met.

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 bench_1model() and free_1context() concurrently from two threads, racing to free the llama_context heap object while the benchmark routine still holds a live reference. On a successful race win, the attacker floods the freed heap region via spray with a crafted buffer embedding a fake vtable, overwriting the vtable pointer at offset +0x30 in llama_batch_allocr so that a subsequent clear() virtual call dispatches to an attacker-controlled function pointer, yielding arbitrary code execution within the app process. No public exploit code is known at time of analysis, though the CVE disclosure documents both the vulnerable function pair and the exact vtable offset, materially reducing development effort.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
No patch listed yet 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

llama.cpp 0.9.0 ≤0.17.1
llama.cpp b1886 ≤b7445

Affected Packages

euvd llama_cpp no fix

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

Vendor (vulncheck) PRIMARY 7.3 HIGH
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
vuln.today AI 7.0 HIGH

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.

3.1 AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:L/AC:H/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE HIGH

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Local
Attack Complexity
High
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

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

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.2%
Top 95% exploitable
Prevalence
Medium
popular open-source LLM inference framework; Android JNI deployment is a narrower subset
Data Quality
9 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub VulDB

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.2%
Patch available No
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

CVE-2024-42479 CRITICAL POC
10.0 Aug 12

Arbitrary memory write in llama.cpp's RPC server allows remote unauthenticated attackers to corrupt arbitrary memory add

CVE-2024-21802 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a user opens a malicious .gguf model file, triggeri

CVE-2026-21869 HIGH POC
8.8 Jan 08

Llama.cpp server endpoints fail to validate the n_discard parameter from JSON input, allowing negative values that trigg

CVE-2024-21825 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) is possible when a victim loads a malicious .gguf model file, trigge

CVE-2024-23605 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (GGUF library) allows attackers to achieve arbitrary code execution by tricking a use

CVE-2024-23496 HIGH POC
8.8 Feb 26

Remote code execution in llama.cpp (commit 18c2e17) occurs when the GGUF library's gguf_fread_str function parses a mali

CVE-2024-21836 HIGH POC
8.8 Feb 26

Heap-based buffer overflow in llama.cpp's GGUF library header parser (commit 18c2e17) enables code execution when a vict

CVE-2025-52566 HIGH POC
8.6 Jun 24

CVE-2025-52566 is a signed vs. unsigned integer overflow vulnerability in llama.cpp's tokenizer (llama_vocab::tokenize f

CVE-2026-34159 CRITICAL
9.8 Apr 01

Remote code execution in llama.cpp RPC backend allows unauthenticated attackers with TCP access to achieve arbitrary mem

CVE-2024-42478 MEDIUM POC
5.3 Aug 12

llama.cpp provides LLM inference in C/C++. Rated medium severity (CVSS 5.3), this vulnerability is remotely exploitable,

CVE-2026-43629 CRITICAL
9.2 Aug 06

Heap buffer overflow in llama.cpp's server KV cache state-restore path (builds b4882 through b9058) lets an attacker who

CVE-2026-43631 CRITICAL
9.2 Aug 06

Remote code execution in llama.cpp's llama-server (builds b7492 through b9060) allows unauthenticated attackers to run a

Vendor StatusVendor

SUSE

Severity: Important

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy