Code execution via unchecked GGUF size addition
Published Mar 12, 2026 · Updated Mar 12, 2026
Heap buffer overflow in llama.cpp before b8146 allows local users to execute code by inducing processing of a crafted GGUF file. In gguf_init_from_file_impl, an unchecked addition of tensor overhead to ctx->size wraps mem_size, so ggml_init allocates a tiny heap buffer before fread copies attacker-controlled tensor data beyond it. The vulnerable no_alloc=false path is used by llama-quantize, llama-imatrix, control vectors, and llama-gguf; the main model loader is unaffected, and demonstrated outcomes range from a crash on macOS to code execution on Linux/glibc.
Summary
What happened
Heap buffer overflow in llama.cpp before b8146 allows local users to execute code by inducing processing of a crafted GGUF file. In gguf_init_from_file_impl, an unchecked addition of tensor overhead to ctx->size wraps mem_size, so ggml_init allocates a tiny heap buffer before fread copies attacker-controlled tensor data beyond it. The vulnerable no_alloc=false path is used by llama-quantize, llama-imatrix, control vectors, and llama-gguf; the main model loader is unaffected, and demonstrated outcomes range from a crash on macOS to code execution on Linux/glibc.
The record
- CVE
- CVE-2026-27940
- Published
- Mar 12, 2026
- Updated
- Mar 12, 2026
- Vendor
- Georgi Gerganov
- Product
- llama.cpp
- Classifications
- CWE-122, CWE-190, T1203
- Attack vector
- local
- Privileges
- unauthenticated
Timeline
How it unfolded
- Mar 12, 2026CVE publishedPublication date reported by the CVE source.
- Mar 12, 2026Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=< b8146
What conditions does exploitation require?
What is affected?
Published CVSS scores
CVSS describes severity. EPSS estimates exploitation probability.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- GHSA-3p4r-fq3f-q74v PoC walkthroughproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo