CVE-2026-70640
Received Received - Intake

Race Condition Use-After-Free in llama.cpp LLaMA-Android JNI

Vulnerability report for CVE-2026-70640, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-06

Last updated on: 2026-08-06

Assigner: VulnCheck

Description

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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-06
Last Modified
2026-08-06
Generated
2026-08-07
AI Q&A
2026-08-07
EPSS Evaluated
N/A
NVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
llama llama_cpp *

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-362 The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.
CWE-476 The product dereferences a pointer that it expects to be valid but is NULL.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This is a race condition use-after-free vulnerability in llama.cpp versions b1886 through b7445. It occurs in the LLaMA-Android JNI wrapper where two functions, bench_1model() and free_1context(), lack proper synchronization. This allows one thread to access freed memory while another thread frees the llama_context, potentially enabling attackers to execute arbitrary code by manipulating memory.

Impact Analysis

If exploited, this vulnerability could allow attackers to execute remote code on your system. This might lead to unauthorized access, data theft, or system compromise. Users of vulnerable versions of llama.cpp, especially those using the LLaMA-Android JNI wrapper, are at risk.

Mitigation Strategies

Update llama.cpp to a version beyond b7445 to address the race condition and use-after-free vulnerability in the LLaMA-Android JNI wrapper.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-70640. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart