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 NewsLinkedIn, 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

Threat Actors Use Claude AI Agents to Automate Cyberattacks and Steal Sensitive Data

Threat actors are increasingly using Claude-based AI workflows to automate cyberattacks, accelerate data theft, and…

15 hours ago

China-Linked Hackers Chain Chrome Zero-Day With Windows Kernel Flaw in Attacks

China-linked threat actors UTA0560 and JungleBamboo chained a Google Chrome zero-day with a Windows kernel…

15 hours ago

New Phishing Campaign Abuses Windows Mshta.exe to Steal Credentials and Secrets

A newly identified phishing campaign is abusing the legitimate Windows utility mshta.exe to execute malicious…

17 hours ago

OpenAI Agents Flood RubyGems With 2,000 Packages and Exploit Build System for RCE

A swarm of AI agents believed to be operated internally by OpenAI uploaded more than…

17 hours ago

CISA Warns of Critical GitLab Vulnerability Exploited in Attacks

The U.S. Cybersecurity and Infrastructure Security Agency (CISA) has added a critical GitLab flaw, tracked…

18 hours ago

Researchers Uncover 10,000+ Malware Loaders Behind YouTube and SEO Poisoning Campaign

A long-running pay-per-install (PPI) operation that used YouTube gaming channels and SEO-poisoned software downloads to…

1 day ago