CVE-2026-70640 Details
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.
A race condition use-after-free vulnerability has been identified in llama.cpp versions b1886 through b7445, specifically within the LLaMA-Android JNI wrapper. The issue arises because the functions bench_1model() and free_1context() lack proper synchronization. This flaw enables one thread to access memory that has already been freed while another thread is in the process of freeing the llama_context. Exploitation of this vulnerability involves a heap spray technique using attacker-controlled data that includes a fake vtable. This manipulation can hijack the vtable pointer, leading to the dereferencing of arbitrary memory and potentially allowing remote code execution.
Users can apply the patch available in the GitHub repository 'Vladimir-tokarev-cyera/llama-cpp-security-patches' to address this vulnerability.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Aug 7, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/ggml-org/llama.cpp/commit/5c0d18881e0e9794c96b2602736b758bac9d9388 | [email protected] | Patch |
| https://github.com/ggml-org/llama.cpp/releases/tag/b7446 | [email protected] | PatchRelease NotesVendor Advisory |
| https://github.com/Vladimir-tokarev-cyera/llama-cpp-security-patches | [email protected] | PatchThird Party Advisory |
| https://www.vulncheck.com/advisories/llama-cpp-b1886-b7445-race-condition-use-after-free-via-llama-android-cpp | [email protected] | ExploitThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-362 | Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') | [email protected] |
| CWE-476 | NULL Pointer Dereference | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| ggml llama.cpp | >= b1886, <= b7445 |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Sep 21, 2026 | Initial Analysis | [email protected] |
| Aug 7, 2026 | CVE Modified | [email protected] |
| Aug 7, 2026 | CVE Modified | CISA-ADP |
| Aug 6, 2026 | New CVE Received | [email protected] |