llama.cpp First Official Security Advisory (CVE-2026-116096): Malicious mmproj Heap OOB Write Analysis and Local Deployment Hardening
For years, developers working with local large language models operated under a common assumption: “Model weights are merely static floating-point matrices. As long as you avoid executing unvetted Python scripts (like pickle payloads before converting to GGUF or safetensors), loading models via low-level C/C++ runtimes like llama.cpp is fundamentally secure.”
That assumption was definitively overturned with the publication of CVE-2026-116096.
As the underlying execution engine powering nearly the entire open-source local inference ecosystem—including Ollama, LM Studio, OpenWebUI, Jan, and Kobold.cpp—llama.cpp has received its first officially assigned CVE. The vulnerability lies directly within the parsing logic for multimodal projection weights (mmproj), resulting in heap out-of-bounds writes with functional proof-of-concept exploits already verified.
If you run local inference servers or multimodal pipelines, here is the technical breakdown and immediate remediation checklist.
1. Vulnerability Breakdown (CVE-2026-116096)
Key Coordinates
- CVE Identifier: CVE-2026-116096
- Project:
ggml-org/llama.cpp - Vulnerable Component: Multimodal multi-task extension
tools/mtmd/models/pockettts-gen.cpp - Vulnerable Function:
list_pockettts_state_slots - Attack Vector: Processing untrusted
--mmproj <filename>files
Technical Root Cause
When parsing state slots during audio multimodal and Pocket-TTS generation, list_pockettts_state_slots deserializes header descriptors and tensor offsets inside the mmproj container.
Because the parser lacked rigorous bounds verification on state slot dimensions and negative tensor offsets, a specially crafted mmproj file with corrupted metadata forces memory pointers beyond the pre-allocated heap buffer boundaries, causing a controllable Heap Out-of-Bounds (OOB) write.
Attack Scenarios & Threat Modeling
- Remote Network Inference (Low Risk): Standard HTTP endpoints accepting user prompts or images cannot directly inject an
mmprojfile over the wire. - Model Supply-Chain Poisoning (Critical Risk): This represents the primary threat vector. Multimodal vision and speech pipelines require companion
mmproj-*.gguffiles. Many developers routinely download pre-quantized weights from third-party community uploads on Hugging Face, ModelScope, or forums. Loading a trojanedmmprojfile immediately triggers memory corruption inside the running process.
2. Official Patch & Runtime Behavior Analysis
Following public disclosure, an emergency patch was merged into master (Commit 0a1ef309cdbb9f2024f58a38fb4c42352c5db569), protecting builds starting from b11796 (recommended build: b11871+).
⚠️ Current Upstream Behavior: “Detected-and-Aborted”
It is essential to understand the current behavior on the master branch:
- Current Master State (
abort()on Assertion): The initial fix replaced the silent heap corruption vulnerability with a strictGGML_ASSERT(...)check. If a malformedmmprojfile is loaded, the process halts immediately with an abort signal. This fully mitigates arbitrary code execution, though it results in an immediate crash rather than graceful error handling. - Comprehensive Sanitization (PR #29360):
PR
#29360(“prevent OOB accesses from malformed mmproj files”) remains open in code review to provide graceful, non-crashing rejection of corrupt files.
Takeaway: Upgrading to b11796 / b11871 or higher fully eliminates the exploitable heap write vulnerability.
3. 5-Minute Verification & Upgrade Instructions
Step 1: Check Your Active Build Version
Run the following in your shell:
llama-cli --version
# or
llama-server --version
- 🔴 Build version <
b11796: Vulnerable. Immediate upgrade required. - 🟢 Build version >=
b11796(e.g.,b11871): Protected against heap exploitation.
Step 2: Upgrade Steps by Environment
Method A: macOS / Linux (Homebrew)
brew update && brew upgrade llama.cpp
llama-server --version
Method B: Source Build (CMake)
cd llama.cpp
git checkout master
git pull origin master
# Build with Metal (macOS)
cmake -B build -DGGML_METAL=ON
cmake --build build --config Release -j$(sysctl -n hw.ncpu 2>/dev/null || nproc)
# Or build with CUDA (Linux with NVIDIA GPU)
# cmake -B build -DGGML_CUDA=ON
# cmake --build build --config Release -j$(nproc)
Method C: Containerized Deployment (Docker)
docker pull ghcr.io/ggml-org/llama.cpp:server
docker stop llama-service && docker rm llama-service
docker run -d --name llama-service -p 127.0.0.1:8080:8080 \
-v /path/to/models:/models \
ghcr.io/ggml-org/llama.cpp:server \
-m /models/your-model.gguf --host 127.0.0.1 --port 8080
4. Production Hardening Checklist for Local Inference
Beyond updating packages, apply these three security practices to protect your hardware infrastructure:
1. Bind to Localhost Exclusively
Never expose bare inference servers with --host 0.0.0.0 unless fronted by an authenticated reverse proxy:
# ❌ Dangerous: Exposes endpoint directly to local network
llama-server -m model.gguf --host 0.0.0.0 --port 8080
# ✅ Secure: Restricted to local loopback with API token
llama-server -m model.gguf --host 127.0.0.1 --port 8080 --api-key "your-strong-token"
2. Verify Weights Against Known Hashes
- Only pull weights and
mmprojfiles from verified organizations (e.g., official Hugging Face repositories likeQwen,google,mistralai, or trusted community quantizers likeunsloth,bartowski). - Check SHA256 checksums before loading new weight files into your production pipeline.
3. Run Post-Upgrade Regression Smoke Tests
After updating any inference binary, execute a quick smoke test to verify that tool-calling schemas and sampling parameters continue to function normally without silent regressions:
llama-cli -m your-model.gguf \
-p "User: State 2+2.\nAssistant:" \
-n 16 --temp 0.1
The security frontier for open-source AI is expanding rapidly from prompt injection mitigations into binary runtime and weight supply-chain safety. Keeping your inference stack patched and isolated is an indispensable prerequisite for production-grade AI deployments.