Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-21869: CWE-787: Out-of-bounds Write in ggml-org llama.cpp

0
High
VulnerabilityCVE-2026-21869cvecve-2026-21869cwe-787
Published: Wed Jan 07 2026 (01/07/2026, 23:37:59 UTC)
Source: CVE Database V5
Vendor/Project: ggml-org
Product: llama.cpp

Description

llama.cpp is an inference of several LLM models in C/C++. In commits 55d4206c8 and prior, the n_discard 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, llama_memory_seq_rm/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.

AI-Powered Analysis

AILast updated: 01/15/2026, 04:37:14 UTC

Technical Analysis

CVE-2026-21869 is an out-of-bounds write vulnerability classified under CWE-787 found in the llama.cpp project, which is a C/C++ implementation for inference of large language models (LLMs). The root cause is improper input validation of the n_discard parameter, which is parsed directly from JSON input in the server's completion endpoints. Specifically, the parameter is not checked to ensure it is non-negative. When a negative value is supplied and the context buffer is full, the llama_memory_seq_rm/add functions receive a reversed range and negative offset. This leads to out-of-bounds memory writes within the token evaluation loop, causing deterministic memory corruption. The consequences include potential process crashes and the possibility of remote code execution (RCE) by an attacker. The attack vector is network-based (AV:N), requiring no privileges (PR:N) but does require user interaction (UI:R) in the form of sending crafted JSON requests to the server. The vulnerability affects all versions of llama.cpp up to commit 55d4206c8, and as of the publication date, no patch or fix has been released. Although no known exploits are currently in the wild, the vulnerability's nature and high CVSS score (8.8) indicate a significant risk. The lack of input validation and direct memory manipulation in a performance-critical section of the code makes exploitation feasible and impactful. This vulnerability could be leveraged by attackers to execute arbitrary code remotely, compromising the confidentiality, integrity, and availability of affected systems running llama.cpp inference servers.

Potential Impact

For European organizations, the impact of CVE-2026-21869 can be severe, especially for those deploying llama.cpp-based LLM inference servers in production or exposed environments. Successful exploitation can lead to remote code execution, allowing attackers to take control of affected systems, steal sensitive data, or disrupt services. This poses a significant risk to confidentiality, integrity, and availability of AI workloads and any integrated systems. Organizations relying on llama.cpp for AI-driven applications, customer-facing chatbots, or internal automation may experience downtime, data breaches, or lateral movement within their networks. The lack of a patch increases exposure time, necessitating immediate mitigations. Additionally, the vulnerability could be exploited as a foothold in targeted attacks against AI research institutions, technology companies, or government agencies in Europe. The potential for process crashes also risks denial-of-service conditions, impacting service reliability. Given the growing adoption of open-source LLM tools in Europe, the threat affects a broad range of sectors including finance, healthcare, and public administration.

Mitigation Recommendations

To mitigate CVE-2026-21869, European organizations should implement strict input validation on the n_discard parameter to ensure it is non-negative before processing. If modifying llama.cpp source code is feasible, adding validation checks or sanitizing JSON inputs at the server endpoint is critical. Until an official patch is released, organizations should restrict network access to the llama.cpp completion endpoints using firewalls or network segmentation to limit exposure to trusted users only. Employ Web Application Firewalls (WAFs) or intrusion detection systems to detect and block anomalous JSON payloads containing negative n_discard values. Monitoring logs for unusual requests or crashes related to llama.cpp servers can provide early warning of exploitation attempts. Running llama.cpp inference servers with least privilege and containerization can reduce the impact of potential compromises. Organizations should also consider alternative LLM inference implementations or temporarily disable exposed endpoints if risk is unacceptable. Finally, maintain close monitoring of vendor updates and community advisories for patches or workarounds.

Need more detailed analysis?Upgrade to Pro Console

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-01-05T16:44:16.368Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 695eeee107b8a419a7712f35

Added to database: 1/7/2026, 11:40:17 PM

Last enriched: 1/15/2026, 4:37:14 AM

Last updated: 2/7/2026, 7:40:18 PM

Views: 300

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats