CVE-2020-24371
Lua vulnerability analysis and mitigation

Overview

CVE-2020-24371 affects Lua 5.4.0, specifically in the lgc.c file where it mishandles the interaction between barriers and the sweep phase, leading to a memory access violation involving collectgarbage. The vulnerability was discovered and disclosed on August 17, 2020 (NVD, MITRE).

Technical details

The vulnerability exists in the garbage collection mechanism of Lua 5.4.0, specifically in the interaction between barriers and the sweep phase. The issue occurs when barriers are active during the sweep phase, even in generational mode. Although generational mode is not incremental, it can hit a barrier when deleting a thread and closing its upvalues. The colors of objects are being changed during sweep and therefore cannot be trusted (LUA_BUGS, LUA_COMMIT). The vulnerability has a CVSS v3.1 Base Score of 5.3 MEDIUM (Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L) (NVD).

Impact

The vulnerability can result in memory access violations when using the collectgarbage function. This can potentially lead to program crashes and availability issues in applications using the affected Lua version (NVD).

Exploitability

The vulnerability requires no special privileges or user interaction to exploit, and can be triggered through the normal use of the collectgarbage function in specific scenarios involving thread deletion and upvalue closure (NVD).

Mitigation and workarounds

The issue has been fixed in later versions of Lua through a patch that prevents barriers from being active during the sweep phase. The fix involves modifications to the lgc.c file to properly handle the interaction between barriers and the sweep phase (LUA_COMMIT). Users should upgrade to a version of Lua newer than 5.4.0.

Additional resources


SourceThis report was generated using AI

Related Lua vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-49844CRITICAL9.9
  • Lua logoLua
  • valkey-debuginfo
NoYesOct 03, 2025
CVE-2022-28805CRITICAL9.1
  • Lua logoLua
  • ntopng
NoYesApr 08, 2022
CVE-2026-24827HIGH7.5
  • Lua logoLua
  • lua
NoYesJan 27, 2026
CVE-2023-4540HIGH7.5
  • Lua logoLua
  • lua5.1-http
NoYesSep 05, 2023
CVE-2022-33099HIGH7.5
  • Lua logoLua
  • ntopng
NoYesJul 01, 2022

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management