Heap-Based Buffer Over-Read in Lua 5.4 - CVE-2022-28805

lua5.4 Updated 02 Oct 2025

Summary

08/04/2022
N/A
No i
Critical
9.1

UBUNTU-CVE-2022-28805: singlevar in lparser.c in Lua from (including) 5.4.0 up to (excluding) 5.4.4 lacks a certain luaK_exp2anyregup call, leading to a heap-based buffer over-read that might affect a system that compiles untrusted Lua code. Affects lua5.4 versions 5.4.2-2 – 5.4.4-1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Lua is a powerful, efficient, lightweight, embeddable scripting language. It is widely used for game development, web applications, and as a scripting language in various software. The package lua5.4 provides version 5.4 of Lua, which includes several enhancements and optimizations. However, a vulnerability has been identified in this version that could lead to serious security issues when untrusted Lua code is executed.

Vulnerability Detail

The vulnerability, identified as CVE-2022-28805, originates from a flaw in the singlevar function within lparser.c in Lua versions from 5.4.0 up to, but not including, 5.4.4. This flaw results in a lack of a specific luaK_exp2anyregup call, which can lead to a heap-based buffer over-read. This vulnerability poses a risk to systems that compile and execute untrusted Lua code, potentially allowing attackers to exploit the buffer over-read to gain unauthorized access to sensitive information or cause application crashes.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If immediate patching is not possible, consider restricting the execution of untrusted Lua code or implementing additional security measures to validate and sanitize inputs before processing them with Lua.

Conclusion

CVE-2022-28805 is a critical vulnerability in Lua 5.4 that can lead to severe security implications when untrusted code is executed. It is essential to update to the patched version to protect your systems from potential exploits. For those unable to update immediately, implementing workarounds can help mitigate risks.

See every vulnerability recorded for lua5.4 →

Share this vulnerability

FAQ

CVE-2022-28805 is a vulnerability in Lua 5.4 that can lead to a heap-based buffer over-read when executing untrusted Lua code.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

The vulnerability can lead to unauthorized access to sensitive information or application crashes, posing a significant security risk.

Yes, a patched version of the lua5.4 package is available. Update to version 5.4.4-1ubuntu0.1~esm1 to mitigate the risk.

If you cannot update, consider restricting the execution of untrusted Lua code and implementing input validation and sanitization.

Related vulnerabilities

Recent vulnerabilities recorded for lua5.4.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback