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-2020-15888

CVE-2020-15888: Lua Buffer Overflow Vulnerability

CVE-2020-15888 is a heap-based buffer overflow in Lua through version 5.4.0 caused by mishandled stack resizes and garbage collection. This article covers the technical details, affected versions, and mitigation.

Published: March 4, 2026

CVE-2020-15888 Overview

CVE-2020-15888 is a memory corruption vulnerability in Lua through version 5.4.0 that occurs due to improper handling of the interaction between stack resizes and garbage collection. This flaw can lead to multiple memory safety issues including heap-based buffer overflow, heap-based buffer over-read, and use-after-free conditions.

Critical Impact

Attackers can potentially achieve arbitrary code execution by exploiting memory corruption conditions that arise when stack reallocation triggers garbage collection, corrupting stack pointers and memory references.

Affected Products

  • Lua 5.4.0 and earlier versions
  • Applications embedding the Lua interpreter
  • Software utilizing Lua for scripting functionality

Discovery Timeline

  • 2020-07-21 - CVE-2020-15888 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2020-15888

Vulnerability Analysis

This vulnerability stems from a race condition between two critical Lua runtime operations: stack resizing and garbage collection. When the Lua interpreter needs to grow or shrink its stack, it performs memory reallocation. However, if garbage collection is triggered during this process, references held by the garbage collector may point to invalid or freed memory regions.

The interaction between these two subsystems was not properly synchronized, allowing for scenarios where:

  1. A stack resize operation begins and relocates the stack buffer
  2. Garbage collection runs before all internal references are updated
  3. The garbage collector accesses stale pointers referencing the old stack location

This results in heap-based buffer overflows when writing to relocated memory, out-of-bounds reads when accessing freed regions, and use-after-free conditions when dereferencing stale pointers.

Root Cause

The root cause lies in the ldo.c file within the Lua source code, specifically in the stack management functions. The luaD_shrinkstack function calculated a "good size" for the stack using an inadequate formula that could result in undersized stack allocations. Additionally, the checkstackp macro did not properly handle garbage collection cycles that could occur during stack reallocation.

The vulnerable code failed to maintain a minimum stack size during shrink operations and did not properly sequence the creation of CallInfo structures with stack size checks, allowing the garbage collector to observe inconsistent internal state.

Attack Vector

The vulnerability is exploitable over the network when applications accept and execute Lua scripts from untrusted sources. An attacker can craft malicious Lua code that manipulates stack depth and triggers garbage collection at precise moments to exploit the race condition. User interaction is required in the form of executing or loading the malicious script.

The following patches from the official Lua repository address the vulnerability:

Stack shrink size fix in ldo.c:

c
 
 void luaD_shrinkstack (lua_State *L) {
   int inuse = stackinuse(L);
-  int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
+  int goodsize = inuse + BASIC_STACK_SIZE;
   if (goodsize > LUAI_MAXSTACK)
     goodsize = LUAI_MAXSTACK;  /* respect stack limit */
   /* if thread is currently not handling a stack overflow and its
      good size is smaller than current size, shrink its stack */
-  if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&
-      goodsize < L->stacksize)
+  if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && goodsize < L->stacksize)
     luaD_reallocstack(L, goodsize, 0);  /* ok if that fails */
   else  /* don't change stack */
     condmovestack(L,{},{});  /* (change only for debugging) */

Source: GitHub Lua Commit 6298903

GC and stack reallocation ordering fix in ldo.c:

c
       f = fvalue(s2v(func));
      Cfunc: {
       int n;  /* number of returns */
-      CallInfo *ci = next_ci(L);
-      checkstackp(L, LUA_MINSTACK, func);  /* ensure minimum stack size */
+      CallInfo *ci;
+      checkstackGCp(L, LUA_MINSTACK, func);  /* ensure minimum stack size */
+      L->ci = ci = next_ci(L);
       ci->nresults = nresults;
       ci->callstatus = CIST_C;
       ci->top = L->top + LUA_MINSTACK;
       ci->func = func;
-      L->ci = ci;
       lua_assert(ci->top <= L->stack_last);
       if (L->hookmask & LUA_MASKCALL) {
         int narg = cast_int(L->top - func) - 1;

Source: GitHub Lua Commit eb41999

Detection Methods for CVE-2020-15888

Indicators of Compromise

  • Unexpected crashes or segmentation faults in applications using Lua scripting
  • Memory corruption errors in system logs associated with Lua interpreter processes
  • Abnormal memory usage patterns in Lua-embedded applications
  • Core dumps showing heap corruption in Lua-related memory regions

Detection Strategies

  • Monitor application logs for Lua interpreter crashes with stack-related error messages
  • Implement runtime memory sanitizers (AddressSanitizer, Valgrind) during testing to detect heap corruption
  • Deploy SentinelOne Singularity to detect anomalous memory access patterns indicative of exploitation
  • Audit systems for Lua versions prior to the security patches

Monitoring Recommendations

  • Enable verbose logging for applications that execute Lua scripts from external sources
  • Implement process monitoring for Lua interpreter child processes with unusual behavior
  • Configure alerting for repeated crashes in Lua-embedded applications
  • Monitor network traffic for potential delivery of malicious Lua scripts to vulnerable endpoints

How to Mitigate CVE-2020-15888

Immediate Actions Required

  • Update Lua to a version containing the security patches (commits 6298903 and eb41999)
  • Restrict execution of untrusted Lua scripts until patching is complete
  • Audit applications embedding Lua to identify all vulnerable deployments
  • Consider sandboxing Lua execution environments with restricted capabilities

Patch Information

The Lua development team has released patches addressing this vulnerability. The fixes are available in the official Lua GitHub repository:

  • Commit 6298903: Maintains minimum stack size during shrink operations by using BASIC_STACK_SIZE instead of a percentage-based calculation
  • Commit eb41999: Reorders CallInfo creation and stack checking to ensure GC-safe operation, introducing the checkstackGCp macro

Organizations should update to Lua versions that include these patches or manually apply the commits to their Lua source builds.

Workarounds

  • Disable or limit execution of Lua scripts from untrusted sources
  • Implement input validation and sanitization for Lua code before execution
  • Deploy application-level sandboxing to contain potential exploitation attempts
  • Configure memory limits for Lua interpreters to reduce exploitation impact
bash
# Example: Checking Lua version and updating on Debian/Ubuntu
lua -v
sudo apt-get update && sudo apt-get install --only-upgrade lua5.4

# For source builds, apply patches manually
cd lua-source-directory
git fetch origin
git cherry-pick 6298903e35217ab69c279056f925fb72900ce0b7
git cherry-pick eb41999461b6f428186c55abd95f4ce1a76217d5
make clean && make linux

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

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechLua

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability1.25%

  • 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-125
  • Technical References
  • Lua Users List Message 53

  • Lua Users List Message 54

  • Lua Users List Message 71

  • Lua Users List Message 79
  • Vendor Resources
  • GitHub Lua Commit 6298903

  • GitHub Lua Commit eb41999
  • Related CVEs
  • CVE-2022-33099: Lua Heap-Buffer Overflow Vulnerability

  • CVE-2022-28805: Lua Buffer Overflow Vulnerability

  • CVE-2020-15889: Lua Buffer Overflow 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