Advisories

llama.cpp b1886–b7445 Race Condition Use-After-Free via llama-android.cpp

Go Back
severity
high
date
Affecting
  • llama.cpp >= b1886, <= b7445

  • llama.cpp >= 0.9.0, <= 0.17.1

CWE
  • CWE-476 NULL Pointer Dereference
  • CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
CVSS
7.3
CVSS V4 Vector
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
Credit
Vladimir Tokarev (@G1ND1L4) - Vulnerability Research Tech Lead, Cyera, Ofek Itach (@ofekitach) - Security Research Team Lead, Cyera
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.

Ready to get Started?

Explore VulnCheck, a next-generation Cyber Threat Intelligence platform, which provides exploit and vulnerability intelligence to help you prioritize and remediate vulnerabilities that matter.
  • Vulnerability Prioritization
    Prioritize vulnerabilities that matter based on the threat landscape and defer vulnerabilities that don't.
  • Early Warning System
    Real-time alerting of changes in the vulnerability landscape so that you can take action before the attacks start.