CVE-2026-130822 in Valkey
Summary
by MITRE • 11/24/2026
In Valkey before 7.2.16, 8.0.x before 8.0.13, 8.1.x before 8.1.12, 9.0.x before 9.0.8, 9.1.x before 9.1.4 and 9.2.0 release candidates, when client eviction is enabled (maxmemory-clients is not 0), an authenticated user who can write to a key that other clients are blocked on (for example with BLPOP, BLMPOP, BZPOPMIN or XREAD BLOCK) can trigger a use-after-free. While the clients blocked on that key are served, evictClients() can select and free the client whose command made the key ready, although that command is still executing, and the server then keeps using the freed client. The blocked clients do not have to belong to the attacker. The result is a reliable crash of the server process. Servers with the default maxmemory-clients 0 are not affected.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability identified in Valkey versions prior to 7.2.16, 8.0.x before 8.0.13, 8.1.x before 8.1.12, 9.0.x before 9.0.8, 9.1.x before 9.1.4, and 9.2.0 release candidates represents a critical memory management flaw within the server's client eviction logic. This issue specifically manifests when the maxmemory-clients configuration directive is set to a non-zero value, thereby enabling automatic eviction of idle or blocked clients based on memory constraints. The core technical deficiency lies in the interaction between command execution and the periodic cleanup routine known as evictClients(). When an authenticated user executes a write operation that unblocks other clients waiting on specific blocking commands such as BLPOP, BLMPOP, BZPOPMIN, or XREAD BLOCK, the server processes these blocked clients to deliver their pending data. However, during this processing phase, if the memory threshold is reached, evictClients() may select and deallocate the client object associated with the very command that triggered the unblocking event. This occurs even though the original command execution context for that attacker-controlled client has not yet fully completed its lifecycle within the server's internal state machine.
This race condition results in a classic use-after-free vulnerability, classified under CWE-416: Use After Free. The fundamental error is that the memory allocator releases the resources associated with the attacking client while pointers to that same object remain active and are subsequently accessed by other parts of the application logic handling the unblocked clients or continuing the command execution pipeline. Because the server continues to reference the freed memory block, it leads to undefined behavior that invariably manifests as a reliable crash of the Valkey process in this specific context. The reliability of the crash is significant because it allows for consistent denial-of-service conditions without requiring complex exploitation techniques beyond triggering the specific sequence of write and eviction events.
From an operational impact perspective, this vulnerability enables any authenticated user with write permissions to keys that are subject to blocking operations to cause a complete service outage by crashing the Valkey server instance. This constitutes a severe Denial of Service (DoS) condition. The attack does not require the attacker to control the clients that are blocked on the key; they merely need to trigger the eviction mechanism while those other clients are being served. Consequently, even if legitimate users or internal services are waiting for data from specific keys, an authenticated malicious actor can disrupt their operations by forcing a server restart through this memory corruption flaw. This impacts availability and potentially integrity if crash dumps expose sensitive information about the system state during recovery.
In terms of threat modeling, this vulnerability aligns with MITRE ATT&CK technique T1499: Endpoint Denial of Service, specifically under sub-techniques involving resource exhaustion or application crashes via memory corruption. It also reflects CWE-787: Out-of-bounds Write in the broader sense that freeing an object while it is still referenced can lead to out-of-bounds accesses if the freed memory is reallocated and modified by another process before being accessed again, although here the primary immediate effect is a crash due to invalid pointer dereference. The vulnerability highlights risks associated with CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization, as the eviction logic does not properly account for the active execution context of the client being evicted when it serves other waiting clients simultaneously.
Mitigation strategies primarily involve upgrading Valkey to a patched version where this race condition has been resolved by ensuring that client objects are not freed while their associated command is still executing or serving dependent blocked clients. For environments where immediate patching is not feasible, administrators can mitigate the risk by setting maxmemory-clients to 0 in the configuration file. This disables automatic eviction of clients based on memory limits for connected sessions, thereby removing the trigger condition required for this specific use-after-free scenario. However, disabling client eviction may lead to other resource exhaustion issues if left unmonitored, so it should be treated as a temporary workaround rather than a permanent solution. Regular auditing of authenticated user permissions and limiting write access to keys involved in blocking operations can also reduce the attack surface available to potential adversaries seeking to exploit this flaw.