Process crash via finalizer during tail call
Published Apr 10, 2023 · Updated Feb 12, 2025
Heap-based buffer over-read in Lua 5.4.3 allows attackers to crash an embedding process by triggering a finalizer during a tail call. The luaD_pretailcall function invokes checkstackGC after partially updating CallInfo, so a garbage-collection finalizer observes an inconsistent call stack and an error path reads beyond a heap buffer. Triggering the fault requires execution of crafted Lua code that combines a large tail call with a failing __gc metamethod; the demonstrated consequence is a process crash.
Summary
What happened
Heap-based buffer over-read in Lua 5.4.3 allows attackers to crash an embedding process by triggering a finalizer during a tail call. The luaD_pretailcall function invokes checkstackGC after partially updating CallInfo, so a garbage-collection finalizer observes an inconsistent call stack and an error path reads beyond a heap buffer. Triggering the fault requires execution of crafted Lua code that combines a large tail call with a failing __gc metamethod; the demonstrated consequence is a process crash.
The record
- CVE
- CVE-2021-45985
- Published
- Apr 10, 2023
- Updated
- Feb 12, 2025
- Vendor
- Unknown vendor
- Product
- Unknown product
- Classifications
- CWE-787
- Attack vector
- network
- Privileges
- unauthenticated
Timeline
How it unfolded
- Apr 10, 2023CVE publishedPublication date reported by the CVE source.
- Feb 12, 2025Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
What conditions does exploitation require?
What is affected?
Affected products and versions are unavailable in this record.
Published CVSS scores
CVSS describes severity. EPSS estimates exploitation probability.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- crash.lua heap-buffer-overflow reproducerproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo