A use-after-free vulnerability exists in Valkey's TLS connection handling that can crash the server that can potentially lead to remote code execution. When TLS is enabled, the server keeps a list of connections that have leftover data waiting to be read. While working through that list, one connection being closed can cause Valkey to access memory belonging to another connection that was just freed.
This happens when an authenticated client closes a connection (for example, via CLIENT KILL) while another TLS connection still has buffered data pending. The freed memory could in principle be reclaimed and controlled via heap grooming which can lead to a potential remote code execution.
This issue only affects deployments with TLS enabled. Non-TLS deployments are not affected.
There is no complete workaround that covers the trigger path without upgrading, but the following mitigations reduce exposure:
CLIENT KILL for users who don't need it: ACL SETUSER <user> -client