llama.cpp builds b1886 through b7445 contain a race condition use-after-free vulnerability in the LLaMA-Android JNI wrapper where bench1model() and free1context() lack synchronization, allowing Thread A to operate on freed memory while Thread B concurrently frees the llamacontext. 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 llamabatch_allocr::clear() to dereference arbitrary memory and achieve remote code execution.
{
"cwe_ids": [
"CWE-362",
"CWE-476"
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/70xxx/CVE-2026-70640.json",
"cna_assigner": "VulnCheck"
}"2026-08-09T08:05:12Z"
[
{
"id": "CVE-2026-70640-09f5f06e",
"deprecated": false,
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"334411191698948442196723930483104454060",
"37366638444284429051614071922669106979",
"139232692773709095660313632590427735062",
"5259375327948776342389338159184170899"
]
},
"source": "https://github.com/ggml-org/llama.cpp/commit/4b2a4778f81f222c12271ce3b1997990b3071faf",
"target": {
"file": "common/arg.cpp"
}
},
{
"id": "CVE-2026-70640-8e669eb6",
"deprecated": false,
"signature_type": "Function",
"signature_version": "v1",
"digest": {
"length": 106923.0,
"function_hash": "337343721808502297225290834391498754494"
},
"source": "https://github.com/ggml-org/llama.cpp/commit/4b2a4778f81f222c12271ce3b1997990b3071faf",
"target": {
"function": "common_params_parser_init",
"file": "common/arg.cpp"
}
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-70640.json"