CVE-2026-21869CWE-787

llama.cpp has Out-of-bounds Write in llama-server

High · published January 7, 2026

CVSS v3.1
8.8
EPSS
1%
Percentile
43.8
In the wild
Unconfirmed
What it is

⚡ Who knew a negative number could lead to such chaos? In the llama.cpp server, an unchecked parameter turns into a ticking time bomb for remote code execution! 🔥 Think of it like a restaurant taking orders without checking if the number of guests is negative. If a diner orders a negative amount of food, the kitchen might start preparing in reverse, resulting in a complete mess! This vulnerability could allow an attacker to execute arbitrary code on your server, leading to potential data breaches or system crashes. It's a serious issue that could compromise the integrity of your application and expose sensitive information. We definitely want to avoid letting this wild negative value take control!

Put simply

Think of it like a restaurant taking orders without checking if the number of guests is negative. If a diner orders a negative amount of food, the kitchen might start preparing in reverse, resulting in a complete mess! In llama.cpp versions prior to commit 55d4206c8, the n_discard parameter is parsed directly from JSON input without validation. When a negative number is supplied, it results in out-of-bounds memory writes, leading to deterministic memory corruption and potential RCE.

What to do

This vulnerability could allow an attacker to execute arbitrary code on your server, leading to potential data breaches or system crashes. It's a serious issue that could compromise the integrity of your application and expose sensitive information. We definitely want to avoid letting this wild negative value take control! While there's no fix available yet, you can mitigate the risk by validating inputs to ensure that n_discard is always a non-negative integer. Regularly monitor updates from the llama.cpp development team for a patch. It's also a good idea to limit access to the affected completion endpoints to trusted sources only. Stay vigilant—this is fixable! By implementing input validation and monitoring for updates, you'll be one step closer to keeping this vulnerability at bay. 🛡️

The record
Technical detail
CVSS v3.1
8.8 · HIGH
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.00528 · 43.8th percentile
Weakness
CWE-787 · Out-of-bounds Write
Published
2026-01-07T23:37Z
EPSS history
Timeline
  • 07 JAN 23:37Z
    llama.cpp has Out-of-bounds Write in llama-server
    cvelistv5