Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-2024-21802

CVE-2024-21802: Llama.cpp Buffer Overflow Vulnerability

CVE-2024-21802 is a heap-based buffer overflow flaw in Ggerganov Llama.cpp that enables attackers to execute arbitrary code via malicious GGUF files. This article covers technical details, affected versions, and mitigation.

Published: April 8, 2026

CVE-2024-21802 Overview

A heap-based buffer overflow vulnerability exists in the GGUF library info->ne functionality of llama.cpp Commit 18c2e17. This vulnerability allows attackers to achieve code execution through specially crafted .gguf files. When a user opens or processes a malicious GGUF model file, the vulnerability can be triggered, potentially leading to complete system compromise.

Critical Impact

This vulnerability enables remote code execution through malicious GGUF model files, requiring no privileges and no user interaction beyond loading the file, posing significant risk to systems using llama.cpp for AI model inference.

Affected Products

  • ggerganov llama.cpp (Commit 18c2e17 and related versions)

Discovery Timeline

  • 2024-02-26 - CVE CVE-2024-21802 published to NVD
  • 2025-11-04 - Last updated in NVD database

Technical Details for CVE-2024-21802

Vulnerability Analysis

This vulnerability represents a heap-based buffer overflow (CWE-122, CWE-787) in the GGUF library's info->ne functionality within llama.cpp. The GGUF format is used for storing and loading Large Language Model (LLM) weights and metadata. The vulnerability occurs during the parsing of GGUF files when the library processes tensor dimension information without proper bounds checking.

When llama.cpp reads a GGUF model file, it parses metadata including tensor information stored in the ne (number of elements per dimension) array. A maliciously crafted GGUF file can specify dimension values that cause the parser to allocate an insufficiently sized buffer, which is subsequently overflowed during data population. This heap corruption can be leveraged for arbitrary code execution.

Root Cause

The root cause is insufficient validation of tensor dimension parameters when parsing GGUF files. The info->ne functionality does not properly verify that the dimension values specified in the file are within acceptable bounds before allocating memory and writing data. This allows an attacker to control the size of heap allocations and the amount of data written to them, creating the classic heap overflow condition.

Attack Vector

The attack vector is network-based, as malicious GGUF files can be distributed through various channels including model repositories, direct downloads, or social engineering. The exploitation scenario involves:

  1. An attacker crafts a malicious .gguf file with manipulated tensor dimension values
  2. The victim downloads or receives the malicious model file
  3. When the victim loads the model using llama.cpp for inference, the vulnerability is triggered
  4. The heap overflow corrupts adjacent memory structures
  5. Through careful heap manipulation, the attacker achieves arbitrary code execution

The vulnerability is particularly concerning in AI/ML workflows where users frequently download and experiment with third-party models from community repositories. For additional technical details, see the Talos Intelligence Vulnerability Report.

Detection Methods for CVE-2024-21802

Indicators of Compromise

  • Unexpected crashes or memory corruption errors when loading GGUF model files
  • Process execution anomalies following model file loading operations
  • Unusual network connections or child processes spawned by llama.cpp applications
  • Abnormally sized or structured .gguf files with suspicious tensor dimension metadata

Detection Strategies

  • Implement file integrity monitoring for GGUF model files in use
  • Monitor process behavior of applications using llama.cpp for unexpected memory access patterns
  • Deploy endpoint detection solutions capable of identifying heap exploitation techniques
  • Utilize application-level monitoring to detect anomalous model loading behavior

Monitoring Recommendations

  • Enable crash dump collection and analysis for applications using llama.cpp
  • Implement logging for all GGUF file load operations including source and file hashes
  • Monitor for suspicious file downloads with .gguf extension from untrusted sources
  • Deploy memory protection mechanisms such as heap canaries and ASLR where available

How to Mitigate CVE-2024-21802

Immediate Actions Required

  • Update llama.cpp to the latest version that includes the security patch
  • Audit all GGUF model files currently in use and verify their source integrity
  • Only load GGUF files from trusted, verified sources
  • Implement network segmentation to limit exposure of systems running llama.cpp

Patch Information

Organizations should update llama.cpp to the latest available version from the official ggerganov repository. The vulnerability was identified in Commit 18c2e17, and subsequent commits have addressed this heap overflow issue. Review the project's commit history and release notes for specific patch information. The Talos Intelligence advisory provides additional details on affected versions.

Workarounds

  • Avoid loading GGUF files from untrusted or unverified sources until patching is complete
  • Implement sandboxing or containerization for llama.cpp processes to limit the impact of potential exploitation
  • Use application whitelisting to restrict model files to known-good checksums
  • Consider running llama.cpp processes with reduced privileges and restricted file system access
bash
# Configuration example - Run llama.cpp in a sandboxed environment
# Using firejail as an example sandbox solution
firejail --private --net=none --caps.drop=all ./main -m trusted_model.gguf

# Alternatively, use Docker with restricted capabilities
docker run --rm --read-only --cap-drop=ALL \
  -v /path/to/trusted/models:/models:ro \
  llama-cpp-image ./main -m /models/model.gguf

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

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechGgerganov Llama.cpp

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.48%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-122

  • CWE-787
  • Technical References
  • Talos Intelligence Vulnerability Report

  • Talos Intelligence Vulnerability Report
  • Related CVEs
  • CVE-2024-23496: Llama.cpp Buffer Overflow Vulnerability

  • CVE-2024-42479: Ggerganov Llama.cpp RCE Vulnerability
Default Legacy - Prefooter | 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