The Redis Lua Use-After-Free Vulnerability (CVE-2025–49844)
A use-after-free flaw in Redis's Lua scripting subsystem allows an authenticated user who can run Lua scripts to manipulate the garbage collector into freeing memory prematurely, then reuse that memory to potentially execute arbitrary native code inside the redis-server process. The vulnerability is rated critical (CVSS 10.0) and was patched in several Redis versions.
medium.com
Published on medium.com
Redis is everywhere. It powers caching, session storage, real-time data, and even message brokering in many modern applications.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a mismatch between Lua's garbage collector and Redis's own memory management, causing memory to be freed while still referenced.
Impact
An attacker could potentially execute arbitrary native code inside the redis-server process, leading to full system takeover, and in multi-tenant or containerized setups this could break isolation boundaries.
What the attacker needed
Authenticated access to Redis; permission to run Lua scripts
The fix
The vulnerability was fixed in Redis versions 6.2.20, 7.2.11, 7.4.6, 8.0.4, and 8.2.2; as a workaround, disable Lua scripting via ACLs.
How it was found
- Craft a Lua script that creates objects the garbage collector will consider for cleanup.
- Force or manipulate a garbage collection cycle when those objects are ripe for collection but still referenced.
- The garbage collector frees memory that is still in use, creating a use-after-free.
- Trigger further operations that use the freed pointer, with attacker-controlled memory reuse.
- Arrange a control flow jump from the Lua VM into native code.
- The redis-server process is compromised.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Redis is a database that can run small programs written in a language called Lua. This bug lets someone who can already run such programs trick Redis into using memory after it has been freed, which can crash the server or let the attacker run their own code on the machine. It is serious because the attacker only needs a normal user account with scripting permission.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.