CVE-2026-82631
Valkey vulnerability analysis and mitigation

Overview

CVE-2026-82631 is a heap use-after-free (UAF) vulnerability in the handleClientsBlockedOnKey() function within src/blocked.c of the Blocked-on-keys Subsystem in valkey-io Valkey 9.1.0 (though the vulnerable pattern likely extends to earlier versions). Reported on July 17, 2026, and publicly disclosed on August 31, 2026, the flaw allows an authenticated remote attacker with high privileges to trigger a denial-of-service condition by causing the server to dereference a freed memory region during blocked-client iteration. It carries a CVSS v3.1 base score of 2.2 (Low) and a CVSS v4.0 base score of 1.2 (Low) (GitHub Advisory, Microsoft MSRC).

Technical details

The root cause is a CWE-416 (Use After Free) / CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer) defect in handleClientsBlockedOnKey(). The function iterates the blocked-client list for a ready key using a plain adlist iterator (listIter), which caches the successor listNode* pointer. When a module-blocked client's reply callback (invoked synchronously via moduleTryServeClientBlockedOnKey) calls ValkeyModule_Call(ctx, "CLIENT", "ccl", "KILL", "ID", second_id), the server synchronously executes freeClient() on the successor blocked client. This teardown path calls unblockClientWaitingData(), which empties c->bstate->keys and invokes dictVanillaFree (i.e., zfree()) on the exact listNode* already cached as li.next in the outer iterator. When the outer loop resumes and calls listNext(&li), it dereferences the freed node, producing a heap-use-after-free confirmed by AddressSanitizer at src/adlist.c:267. A public PoC (readykey_iter_uaf.c) was released alongside the issue report (GitHub Issue #4198, PoC ZIP).

Impact

Successful exploitation results in a server-side crash (Denial of Service) of the Valkey server process, as the heap-use-after-free causes an abort under AddressSanitizer or undefined behavior in production builds. There is no confidentiality or integrity impact — the vulnerability is limited to availability. Because Valkey is commonly used as a high-performance caching and key-value store in production environments, a crash can disrupt dependent applications and services (GitHub Issue #4198, GitHub Advisory).

Exploitability

A proof-of-concept exploit (readykey_iter_uaf.c) was publicly released alongside the vulnerability report, requiring the attacker to load a custom Valkey module and have high-privilege access to the server. Exploitation requires high attack complexity — specifically, two clients must be blocked on the same key via ValkeyModule_BlockClientOnKeys(), and the first client's reply callback must synchronously kill the second via CLIENT KILL. The EPSS score is approximately 0.358%, and there is no evidence of in-the-wild exploitation or CISA KEV catalog listing as of the disclosure date. The NVD SSVC assessment classifies exploitation as "poc" with no automation (GitHub Issue #4198, GitHub Advisory).

Exploitation steps

  1. Setup: Obtain high-privilege (authenticated) access to a Valkey 9.1.0 server instance that supports module loading.
  2. Compile and load the PoC module: Build the readykey_iter_uaf.c shared library with AddressSanitizer enabled (gcc -shared -fPIC -O0 -g -Isrc readykey_iter_uaf.c -o /tmp/readykey_iter_uaf.so) and start the server with --loadmodule /tmp/readykey_iter_uaf.so.
  3. Block first client: From client A, issue readyuaf.block race first — this blocks client A on the key race using ValkeyModule_BlockClientOnKeys() and registers a reply callback that will kill the successor client.
  4. Block second client: From client B, issue readyuaf.block race second — this blocks client B on the same key race and records its client ID for the kill operation.
  5. Signal the ready key: From a third connection, issue readyuaf.signal race — this triggers handleClientsBlockedOnKey() to iterate the blocked-client list for race.
  6. Trigger UAF: The server serves client A first; client A's reply callback calls ValkeyModule_Call(ctx, "CLIENT", "ccl", "KILL", "ID", second_id), synchronously freeing client B's list node — which is already cached as li.next in the outer iterator. The outer loop then calls listNext(&li), dereferencing the freed node and triggering the heap-use-after-free, crashing the server (GitHub Issue #4198, PoC ZIP).

Indicators of compromise

  • Process: Valkey server process (valkey-server) crashes or aborts unexpectedly, particularly with an AddressSanitizer error message referencing heap-use-after-free at src/adlist.c:267 in listNext().
  • Logs: Server logs showing ==ERROR: AddressSanitizer: heap-use-after-free with stack traces involving handleClientsBlockedOnKey, handleClientsBlockedOnKeys, moduleTryServeClientBlockedOnKey, and unblockClientWaitingData.
  • Network: Unusual sequences of CLIENT KILL ID <id> commands issued from a module context (via ValkeyModule_Call) shortly after multiple clients block on the same key.
  • File System: Presence of unexpected .so module files (e.g., readykey_iter_uaf.so) loaded into the Valkey server via --loadmodule or MODULE LOAD commands.

Mitigation and workarounds

The fix is identified as commit b2fb0e13f5b4c8c2fb63dcfc2c37a067a0d6d20b, merged into the unstable branch on August 7, 2026, via PR #4212. The patch replaces the unsafe listIter-based traversal with a snapshot of stable client IDs, re-resolving each client from the live blocking list before serving, thereby preventing stale pointer dereferences across reentrant callbacks. Backports were applied to Valkey branches 7.2, 8.0, 8.1, 9.0, and 9.1 as of late August 2026. Operators should upgrade to a patched release as soon as available; as a short-term workaround, restrict module loading to trusted modules only and enforce strict access controls to limit high-privilege client access (GitHub PR #4212, Patch Commit).

Community reactions

The vulnerability was reported by researcher gff-cw via GitHub Issue #4198 on July 17, 2026, with a detailed root cause analysis and PoC. Valkey maintainer ranshid noted that the vulnerable pattern likely predates version 9.1.0 and may affect versions as far back as 7.2, prompting backports across all active release branches. Contributor AlisinaDevelo independently reviewed the fix and identified a potential ABA pointer-reuse edge case in the initial patch, which was subsequently addressed. The fix was also later rewritten in a simpler rotation-based approach (PR #4472) by enjoy-binbin for improved readability (GitHub Issue #4198, GitHub PR #4212).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Affected

sid

valkey

Affected

trixie

valkey

Affected

Ubuntu

Unknown

devel

valkey

Unknown

noble

valkey

Unknown

noble (esm-apps)

valkey

Unknown

resolute

valkey

Unknown

SourceThis report was generated using AI

Related Valkey vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-63639HIGH8.8
  • Rocky Linux logoRocky Linux
  • valkey-compat-redis-devel
NoYesAug 18, 2026
CVE-2026-85522MEDIUM5.5
  • Valkey logoValkey
  • valkey
NoNoSep 04, 2026
CVE-2026-82677LOW1.9
  • Valkey logoValkey
  • valkey
NoNoAug 31, 2026
CVE-2026-86227LOW1.3
  • Valkey logoValkey
  • valkey
NoNoSep 06, 2026
CVE-2026-82631LOW1.2
  • Valkey logoValkey
  • valkey
NoYesAug 31, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management