CVE-2026-21869: llama.cpp has Out-of-bounds Write in llama-server
llama.cpp is an inference of several LLM models in C/C++. In commits 55d4206c8 and prior, the ndiscard parameter is parsed directly from JSON input in the llama.cpp server's completion endpoints without validation to ensure it's non-negative. When a negative value is supplied and the context fills up, llamamemoryseqrm/add receives a reversed range and negative offset, causing out-of-bounds memory writes in the token evaluation loop. This deterministic memory corruption can crash the process or enable remote code execution (RCE). There is no fix at the time of publication.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-21869?
CVE-2026-21869 has a medium severity rating due to the potential for negative values to cause unexpected behavior.
How do I fix CVE-2026-21869?
To fix CVE-2026-21869, ensure that the n_discard parameter is validated to be non-negative before processing it.
Which versions of llama.cpp are affected by CVE-2026-21869?
CVE-2026-21869 affects llama.cpp versions prior to 55d4206c8.
What is the impact of CVE-2026-21869?
CVE-2026-21869 can lead to application crashes or erratic behavior if a negative n_discard value is supplied.
Is there a known exploit for CVE-2026-21869?
As of now, there is no public record of an exploit specifically targeting CVE-2026-21869.