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
    • 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-2026-40504

CVE-2026-40504: Creolabs Gravity RCE Vulnerability

CVE-2026-40504 is a heap buffer overflow RCE vulnerability in Creolabs Gravity that enables attackers to execute arbitrary code through crafted scripts. This article covers technical details, affected versions, and mitigation.

Published: April 17, 2026

CVE-2026-40504 Overview

CVE-2026-40504 is a critical heap buffer overflow vulnerability in Creolabs Gravity, a lightweight scripting language designed for embedding in applications. The vulnerability exists in the gravity_vm_exec function and allows attackers to write out-of-bounds memory by crafting malicious scripts containing numerous string literals at global scope. Insufficient bounds checking in the gravity_fiber_reassign() function enables heap metadata corruption, potentially leading to arbitrary code execution in applications that evaluate untrusted Gravity scripts.

Critical Impact

Attackers can achieve arbitrary code execution by exploiting heap buffer overflow through crafted Gravity scripts, compromising applications that process untrusted user-supplied scripts.

Affected Products

  • Creolabs Gravity versions prior to 0.9.6
  • Applications embedding the Gravity scripting language engine
  • Development environments utilizing Gravity for script evaluation

Discovery Timeline

  • 2026-04-16 - CVE-2026-40504 published to NVD
  • 2026-04-16 - Last updated in NVD database

Technical Details for CVE-2026-40504

Vulnerability Analysis

This heap buffer overflow vulnerability (CWE-122) resides in the Gravity virtual machine execution layer. When the Gravity VM processes scripts containing a large number of string literals defined at global scope, the gravity_fiber_reassign() function fails to properly validate buffer boundaries before writing data. This insufficient bounds checking allows memory writes beyond the allocated heap buffer, corrupting adjacent heap metadata structures.

The vulnerability is particularly dangerous because it affects the core script execution engine. Any application that embeds Gravity and allows users to supply scripts—such as game modding frameworks, configuration systems, or automation tools—could be vulnerable to exploitation. The network attack vector indicates that remotely-delivered scripts can trigger this condition without requiring local access.

Root Cause

The root cause stems from inadequate bounds checking within the gravity_fiber_reassign() function when handling fiber (coroutine) reassignment operations during VM execution. When scripts declare numerous string literals at global scope, the function does not properly verify that write operations remain within the allocated buffer boundaries. This oversight allows controlled out-of-bounds writes that can corrupt heap metadata, enabling attackers to manipulate memory allocation behavior and potentially redirect execution flow.

Attack Vector

The attack vector involves crafting a malicious Gravity script that declares an excessive number of string literals at global scope. When this script is parsed and executed by the Gravity VM, the gravity_vm_exec function processes these literals, eventually triggering the vulnerable code path in gravity_fiber_reassign(). The attacker-controlled heap corruption can be leveraged to:

  1. Overwrite function pointers or vtable entries
  2. Corrupt heap metadata to achieve write-what-where conditions
  3. Hijack control flow to execute arbitrary shellcode

Applications processing untrusted scripts from network sources, user uploads, or plugin systems are at elevated risk. The vulnerability requires no authentication or user interaction beyond script submission, making it exploitable in automated pipelines.

The vulnerability mechanism involves insufficient validation in the fiber reassignment function during script execution. When many string literals are declared at global scope, the internal buffer handling fails to enforce proper boundaries. Technical details are available in the GitHub Issue Discussion and the VulnCheck Security Advisory.

Detection Methods for CVE-2026-40504

Indicators of Compromise

  • Gravity scripts containing unusually high numbers of string literal declarations at global scope
  • Application crashes or unexpected terminations in processes utilizing the Gravity VM
  • Memory corruption errors or heap integrity violations in application logs
  • Abnormal memory allocation patterns in applications embedding Gravity

Detection Strategies

  • Monitor for scripts with excessive global-scope string literals exceeding normal thresholds
  • Implement runtime heap integrity checking in applications embedding Gravity
  • Deploy application-level input validation to limit script complexity before VM execution
  • Use memory sanitizers (ASan, MSan) during development and testing of Gravity-integrated applications

Monitoring Recommendations

  • Enable crash dump collection and analysis for applications using Gravity scripting
  • Implement logging around script submission and execution endpoints
  • Monitor process memory usage for anomalous growth patterns during script evaluation
  • Configure alerting for heap corruption detection mechanisms in production environments

How to Mitigate CVE-2026-40504

Immediate Actions Required

  • Upgrade Creolabs Gravity to version 0.9.6 or later immediately
  • Audit all applications embedding Gravity to identify vulnerable deployments
  • Restrict or disable untrusted script execution until patches are applied
  • Implement script validation and sandboxing as defense-in-depth measures

Patch Information

Creolabs has released version 0.9.6 which addresses this heap buffer overflow vulnerability. The fix is available through the GitHub Release Version 0.9.6. The specific commit addressing this vulnerability can be reviewed at the GitHub Commit Update.

Organizations should prioritize updating all Gravity installations and rebuilding applications that statically link the Gravity library. For dynamically linked deployments, replacing the shared library with the patched version is sufficient.

Workarounds

  • Implement strict input validation to limit the number of string literals permitted in submitted scripts
  • Deploy script execution within sandboxed environments with restricted memory access
  • Use process isolation techniques to contain potential exploitation impact
  • Consider script pre-processing to reject scripts exceeding safe complexity thresholds
bash
# Configuration example - Upgrade Gravity to patched version
git clone https://github.com/marcobambini/gravity.git
cd gravity
git checkout 0.9.6
make clean && make
sudo make install

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechCreolabs Gravity

  • SeverityCRITICAL

  • CVSS Score9.3

  • EPSS Probability0.07%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-122
  • Technical References
  • GitHub Commit Update

  • GitHub Issue Discussion

  • GitHub Release Version 0.9.6

  • VulnCheck Security Advisory
  • Latest CVEs
  • CVE-2025-52479: HTTP.jl & URIs.jl CRLF Injection Flaw

  • CVE-2026-31740: Linux Kernel Race Condition Vulnerability

  • CVE-2026-31743: Linux Kernel Buffer Overflow Vulnerability

  • CVE-2026-31744: Linux Kernel NULL Pointer 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