0:00
–:––
React at 0:00
DEF CON 34

Breaking Local AI Runtimes: Exploiting llama.cpp and Ollama

When and where

Day
Fri 7 Aug 2026
Time
10:30 to 11:30 PDT
Room
LVCC - L1 - Exhibit Hall West 3 - 1007 (Main Track 2)

Speakers

  • Vladimir Tokarev is a vulnerability researcher tech lead at Cyera, specializing in Cloud, IoT/OT, Windows, Linux, and AI vulnerability research and exploit. Talks: Black Hat USA 2024 and 2023, DEF CON 33 Recon Village 2025, CodeBlue 2025, RSA 2024.

  • Security Research Team Lead at Cyera. Focus areas include cloud infrastructure and AI-related platform security. Talks: Black Hat USA 2024, DEF CON 32 (2024), RSA 2024, Sector 2024, INTENT 2024, Black Hat Europe 2024 Arsenal. Earlier work includes AWS internals and cloud attack surface mapping.

Abstract

Local LLM runtimes now sit inside phones, desktops, and internal servers, but the layer underneath is still ordinary native code. We analyzed llama.cpp and Ollama across three trust boundaries: JNI, HTTP lifecycle code, and Go/C bindings. First, in the llama.cpp Android integration, Java can free a native llama_context while native code is still using it. We reclaim the freed 648-byte object, redirect a vtable call, and show code execution in the embedding app. Second, in llama.cpp server, idle model teardown can race active requests, leaving a dangling pointer inside a freed 17,816-byte model allocation. We show remote cross-thread reclaim and attacker-controlled native dereference, then explain the remaining steps to stable RCE. Third, in Ollama, malicious GGUF metadata can push unsafe lengths across the Go/C boundary during quantization, causing C to read past a Go-backed buffer and return heap data to the caller. This is not a prompt-injection talk. It is about exploiting local AI runtimes as native software: one full exploit, one validated server-side primitive, one disclosure primitive, and the audit patterns that find more. 1. Mergendahl, Louloudis, Vidas. "Cross-Language Attacks." NDSS Symposium 2022. 2. Hussain. "Incubated Machine Learning Exploits." DEF CON 32, 2024. 3. Riancho, Braverman, Demetrio. "Breaking Out of The AI Cage." Black Hat USA 2025. 4. llama.cpp project: https://github.com/ggml-org/llama.cpp 5. Ollama project: https://github.com/ollama/ollama 6. llama.cpp Android sample: https://github.com/ggml-org/llama.cpp/tree/master/examples/llama.android

What you'll get from it

Local LLM runtimes are ordinary native code underneath, and Vladimir "G1ND1L4" Tokarev and Ofek Itach treat llama.cpp and Ollama that way. They show three bugs at three trust boundaries: a use-after-free in the llama.cpp Android integration taken to code execution in the embedding app, a race between idle model teardown and active requests in llama.cpp server that leaves a dangling pointer, and malicious GGUF metadata in Ollama that leaks heap data across the Go/C boundary. They also share the audit patterns that find more. Memory-corruption researchers curious about AI targets, and anyone shipping these runtimes, should watch.

Did you find what you came for?