The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-21869

CVE-2026-21869: llama.cpp RCE Vulnerability

CVE-2026-21869 is a remote code execution flaw in llama.cpp caused by unvalidated negative n_discard parameter input. This memory corruption issue can crash the process or enable RCE. This article covers technical details, affected versions, impact, and mitigation strategies.

Updated: January 22, 2026

CVE-2026-21869 Overview

A critical out-of-bounds write vulnerability has been identified in llama.cpp, the popular LLM inference library written in C/C++. The vulnerability exists in the server's completion endpoints where the n_discard parameter is parsed directly from JSON input without validation to ensure non-negative values. When a negative value is supplied and the context fills up, the llama_memory_seq_rm and llama_memory_seq_add functions receive a reversed range and negative offset, causing deterministic out-of-bounds memory writes during token evaluation.

Critical Impact

This vulnerability enables deterministic memory corruption that can crash the llama.cpp server process or potentially enable remote code execution (RCE) against systems running vulnerable versions.

Affected Products

  • llama.cpp commits up to and including 55d4206c8
  • llama.cpp server instances with completion endpoints exposed

Discovery Timeline

  • 2026-01-08 - CVE-2026-21869 published to NVD
  • 2026-01-08 - Last updated in NVD database

Technical Details for CVE-2026-21869

Vulnerability Analysis

This vulnerability stems from insufficient input validation in llama.cpp's server completion endpoints. The n_discard parameter, which controls how many tokens should be discarded from the context during inference, is accepted directly from user-supplied JSON without bounds checking. The absence of validation for negative values creates a dangerous condition where memory operations can be manipulated by an attacker.

When a user submits a request with a negative n_discard value and the model's context buffer fills up during processing, the internal memory management functions llama_memory_seq_rm and llama_memory_seq_add are invoked with corrupted parameters. The negative value causes range calculations to invert, resulting in a negative offset being passed to the token evaluation loop. This triggers writes to memory locations outside the intended buffer boundaries.

The vulnerability is classified under CWE-787 (Out-of-bounds Write), which represents one of the most dangerous vulnerability categories due to its potential to corrupt critical data structures, crash applications, or enable arbitrary code execution.

Root Cause

The root cause is the complete absence of input validation for the n_discard parameter in the JSON parsing logic of the completion endpoint handlers. The parameter is expected to be a non-negative integer representing the number of tokens to discard, but the code fails to enforce this constraint before using the value in memory offset calculations.

Attack Vector

An attacker can exploit this vulnerability remotely over the network by sending a crafted HTTP request to the llama.cpp server's completion endpoint. The attack requires user interaction in the form of processing a malicious request, but no authentication or special privileges are needed. The attacker constructs a JSON payload containing a negative n_discard value and submits it to the server. When the server processes this request and the context fills during inference, the out-of-bounds write occurs.

The vulnerability manifests in the memory management functions when processing token sequences. By supplying a negative n_discard value, the attacker causes the range parameters passed to llama_memory_seq_rm and llama_memory_seq_add to become inverted, and the offset calculation produces a negative value. This results in writes to memory addresses before the intended buffer, corrupting adjacent data structures. For technical details, refer to the GitHub Security Advisory.

Detection Methods for CVE-2026-21869

Indicators of Compromise

  • Unexpected crashes or segmentation faults in llama.cpp server processes
  • HTTP requests to completion endpoints containing negative integer values for n_discard
  • Anomalous memory access patterns or core dumps from llama.cpp processes
  • Error logs indicating memory corruption or invalid memory operations

Detection Strategies

  • Implement web application firewall (WAF) rules to inspect JSON payloads for negative n_discard values
  • Monitor llama.cpp server logs for unusual request patterns or processing errors
  • Deploy application-level input validation to reject requests with negative parameter values
  • Use runtime memory protection tools to detect out-of-bounds memory access attempts

Monitoring Recommendations

  • Enable verbose logging on llama.cpp server instances to capture request parameters
  • Implement network traffic analysis to identify suspicious patterns targeting completion endpoints
  • Deploy crash monitoring and automated alerting for llama.cpp processes
  • Conduct regular log reviews for requests containing unexpected parameter values

How to Mitigate CVE-2026-21869

Immediate Actions Required

  • Restrict network access to llama.cpp server instances to trusted sources only
  • Implement input validation at the network perimeter to reject negative n_discard values
  • Consider temporarily disabling public access to completion endpoints until a patch is available
  • Deploy network segmentation to isolate AI inference servers from critical infrastructure

Patch Information

There is no official fix available at the time of publication. Organizations should monitor the llama.cpp GitHub repository for security updates and apply patches immediately when released. The vulnerability affects commits 55d4206c8 and prior.

Workarounds

  • Implement a reverse proxy or API gateway with input validation to sanitize n_discard parameters
  • Use network-level access controls to limit which clients can reach the completion endpoints
  • Deploy Web Application Firewall rules to block requests with negative integer values in JSON payloads
  • Run llama.cpp server processes in sandboxed environments to limit the impact of potential exploitation
bash
# Example nginx configuration to block negative n_discard values
# Add to server block protecting llama.cpp endpoint
location /completion {
    # Reject requests containing negative n_discard
    if ($request_body ~* "\"n_discard\"\s*:\s*-[0-9]+") {
        return 400;
    }
    proxy_pass http://llama_backend;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechLlama Cpp

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.14%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-787
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-34159: llama.cpp RPC Backend RCE Vulnerability

  • CVE-2026-33298: llama.cpp Integer Overflow RCE Vulnerability

  • CVE-2026-27940: llama.cpp Buffer Overflow Vulnerability

  • CVE-2026-2069: llama.cpp Buffer Overflow Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English