Cyber Security News

PoC Exploit Released for Critical Vulnerabilities in Lua Engine

A new proof-of-concept exploit has been released for three severe vulnerabilities in the Lua scripting engine used by Redis 7.4.5.

Security researchers discovered that attackers can trigger remote code execution and privilege escalation by abusing flaws in the Lua parser, the unpack() function, and the protection of basic type metatables.

These issues pose a direct threat to systems that allow untrusted scripts via the EVAL command and demand immediate patching.

During a routine audit of Redis 7.4.5, three critical flaws were found in the Lua engine. The first, CVE-2025-49844, involves a use-after-free defect in the Lua parser.

When parsing scripts, the engine allocates a TString object without safeguarding it on the stack.

A garbage collection cycle can free this object too soon, allowing an attacker to overwrite memory and execute arbitrary code.

The second flaw, CVE-2025-46817, stems from an integer overflow in the unpack() function. By supplying extreme index values, an attacker can corrupt the Lua stack and hijack control flow.

The third, CVE-2025-46818, concerns privilege escalation through metatable modification. Core type metatables for strings, numbers, and other primitives are mutable and can be altered to inject malicious code that runs in other users’ contexts.

Technical Details

The use-after-free issue occurs at line 387 in deps/lua/src/lparser.c. The raw parser code calls luaS_new(L, name) but fails to push the result onto the Lua stack, leaving it unprotected.

In contrast, the patched version uses setsvalue2s(L, L->top, tname) and incr_top(L) before parsing to guard the new string.

The integer overflow vulnerability in deps/lua/src/lbaselib.c miscalculates element count as n = e – i + 1, which overflows when e is very large.

This error leads to writing beyond stack bounds. For the metatable issue, files src/script_lua.c and src/eval.c lacked checks to prevent writes to basic type metatables, enabling unauthorized code injection.

Below is a concise table summarizing these vulnerabilities:

CVEVulnerabilityImpactExploit PrerequisitesCVSS 3.1 Score
CVE-2025-49844Use-After-Free in Lua ParserRemote Code ExecutionEVAL access9.8
CVE-2025-46817Integer Overflow in unpack()Remote Code ExecutionEVAL access9.8
CVE-2025-46818Metatable Privilege EscalationPrivilege EscalationEVAL access9.8

PoC and Mitigation

A complete Python PoC tests all three flaws against a live Redis server. For example, the use-after-free test fills Lua memory to force garbage collection during parsing:

# Step 1: Create memory pressure

for i in range(50):

    huge_script = "local t={}; " + ";".join([f"t[{j}]=string.rep('X',10000)" for j in range(50)]) + "; return 'ok'"

    client.eval(huge_script, 0)

# Step 2: Trigger GC during parse

client.eval("collectgarbage('collect'); return 'gc'", 0)

The unpack() overflow check uses scripts like return {unpack({1,2,3}, -2, 2147483647)} to detect errors, while metatable protection is confirmed by attempts to modify a nil metatable.

Organizations should upgrade to Redis 7.4.6 or later, where patches include stack protection in the parser, bounds checks in unpack(), and readonly enforcement on basic metatables.

Applying these updates will close the attack surface and restore script isolation. Continuous monitoring for unexpected EVAL activity and strict access controls are also recommended to reduce risk.

Follow us on Google News, LinkedIn, and X to Get Instant Updates and Set GBH as a Preferred Source in Google.

Divya

Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Recent Posts

Hackers Use ConnectWise SkyKick Credentials to Access Microsoft 365, Halting Cloud Backups

Attackers abused compromised ConnectWise Cloud Backup credentials to access Microsoft 365 customer environments, prompting ConnectWise…

1 day ago

Anthropic’s Claude AI Uncovers Origins of NSA-Provided Cryptographic Keys After 25 Years

Anthropic says an internal Claude research model reconstructed how the National Security Agency generated seeds…

1 day ago

Critical WordPress Flaws Allow Attackers to Execute Remote Code Without Authentication

Two WordPress Core vulnerabilities can be chained to execute remote code without authentication, according to…

1 day ago

OpenBSD Kernel Flaw Dating Back 37 Years Enables Local Privilege Escalation to Root

A newly disclosed OpenBSD kernel exploitation chain combines a shared memory accounting flaw with a…

1 day ago

GhostAction Hackers Hide Credential-Stealing Malware in Fake Font Files Across 94 GitHub Repositories

GhostAction attackers have expanded their GitHub credential theft campaign with a second stage that disguises…

1 day ago

SideCopy Hackers Target Indian Organizations With ReverseRAT Malware to Steal Data

Indian authorities have warned that SideCopy hackers are targeting Indian organizations, including academic institutions, with…

1 day ago