REDHAT-BUG-2583397: Use After Free
In Valkey 9.1.0 and 9.1.1, the Lua script debugger builds its command table once and caches it with a pointer to the Lua interpreter state that was current at the time. SCRIPT FLUSH ASYNC recreates the scripting engine and frees the previous interpreter state without invalidating that cache, so the next debugger command dereferences freed memory. An authenticated user who can run scripting commands can use this to reliably crash the server, and by reclaiming the freed heap chunk with attacker-controlled bytes can escalate it to control of an indirect call, which may lead to remote code execution. The fix also addresses a second use-after-free in ldbLogStackValue. Valkey 8.0.x and 8.1.x use the previous debugger and are not affected.
Affected Software
Event History
Frequently Asked Questions
Which Valkey versions are affected?
Valkey 9.1.0 and 9.1.1 are affected. Valkey 8.0.x and 8.1.x use the previous debugger implementation and are not affected.
What level of access does an attacker need?
An attacker must be authenticated and able to run scripting commands. The issue is triggered when SCRIPT FLUSH ASYNC recreates the scripting engine and a subsequent Lua debugger command uses the stale cached state.
What is the practical impact for an affected server?
An authorized attacker can reliably crash the server. If they can reclaim the freed heap chunk with attacker-controlled data, the use-after-free may be escalated to control of an indirect call and potentially remote code execution.