Five functions wrote the check. The sixth is the bug.
t_stream.c declares its stack-vs-heap threshold at line 24:
/* For stream commands that require multiple IDs
* when the number of IDs is less than 'STREAMID_STATIC_VECTOR_LEN',
* avoid malloc allocation.*/
#define STREAMID_STATIC_VECTOR_LEN 8
The constant exists because Redis stream commands take a caller-supplied array of IDs whose count is unbounded by the protocol, and the codebase prefers not to call malloc in the common small case. Six places in this file use the idiom. The canonical example is xdelexCommand, at line 4020 of the 8.2.0 vulnerable build, also added by PR #14130:
streamID static_ids[STREAMID_STATIC_VECTOR_LEN];
streamID *ids = static_ids;
if (args.numids > STREAMID_STATIC_VECTOR_LEN)
ids = zmalloc(sizeof(streamID)*args.numids);
for (int j = 0; j < args.numids; j++) {
if (streamParseStrictIDOrReply(c,c->argv[j+args.startidx],&ids[j],0,NULL) != C_OK)
goto cleanup;
}
Six lines of idiom. Declare a static array of eight streamID slots. Point ids at it. If the caller's count exceeds eight, swap ids to a heap allocation sized to fit. Then write through ids.
The same idiom appears at line 2307 inside xreadCommand, at line 3140 inside xackCommand, at line 3564 inside xclaimCommand, at line 3940 inside xdelCommand, and at line 4020 inside xdelexCommand. Five times. Each one carries the if (count > STREAMID_STATIC_VECTOR_LEN) ids = zmalloc(...) line that the header comment told the developer to write.
Here is the same idiom at line 3206, inside xackdelCommand:
streamID static_ids[STREAMID_STATIC_VECTOR_LEN];
streamID *ids = static_ids;
for (int j = 0; j < args.numids; j++) {
if (streamParseStrictIDOrReply(c,c->argv[j+args.startidx],&ids[j],0,NULL) != C_OK)
goto cleanup;
}
Two lines are missing. The if. The zmalloc. The eight-slot stack buffer now absorbs args.numids writes, where args.numids is the caller-supplied count from the RESP-level command XACKDEL key group IDS <numids> id [id ...].
Each ID is a sixteen-byte write the caller controls
streamID is two uint64_t fields, ms and seq, sixteen bytes total. The wire format is the ASCII <ms>-<seq> Redis users type at the CLI, parsed by streamParseStrictIDOrReply into the binary struct. Neither field is range-validated. Both are caller-controlled bytes after the parse.
streamID static_ids[STREAMID_STATIC_VECTOR_LEN] is 128 bytes on the stack. The compiler places the array inside xackdelCommand's stack frame, beside whatever else the function spills. JFrog's exploitation analysis, reproduced here in PoC form against the published 8.2.0 binaries on x86-64 and ARM64, identifies where the saved return address lands relative to the array. Slot 53, specifically the seq half of the 53rd streamID, overlaps the saved rip.
The attacker authenticates, calls XACKDEL on a stream they have permission to write to, and sends enough IDs to reach the saved return address. The 53rd ID's seq becomes the return target. The next IDs become a ROP chain. The x86-64 chain in the PoC is six gadgets and a payload: pop rdi; ret to set the page address, pop rsi; ret to set the length, pop rdx; ret to set the permissions, mprotect to make the stack RWX, call rsp to enter shellcode that the same overflow wrote into adjacent stream IDs. The ARM64 chain is forty slots because AArch64 takes more gadget plumbing to populate x0 through x3 for the mprotect call.
The CVSS vector is PR:L. The realistic attacker is any application user that has permission to acknowledge stream messages, which is the population of every Redis-streams-as-work-queue consumer. Redis 8.2's ACL system defaults deny-everything; a tightly-configured cluster grants XACKDEL only where it is needed. XACKDEL is the canonical acknowledge-and-delete operation. Every consumer of a Redis stream tends to hold the permission.
The patch is the idiom
The patch commit is 5f83972188f6e5b1d6f1940218c650a9cbdf7741, "Fix XACKDEL stack overflow when IDs exceed STREAMID_STATIC_VECTOR_LEN (CVE-2025-62507)". The diff to src/t_stream.c is two lines:
streamID static_ids[STREAMID_STATIC_VECTOR_LEN];
streamID *ids = static_ids;
+ if (args.numids > STREAMID_STATIC_VECTOR_LEN)
+ ids = zmalloc(sizeof(streamID)*args.numids);
for (int j = 0; j < args.numids; j++) {
The two lines that appear inside xreadCommand. Inside xackCommand. Inside xclaimCommand. Inside xdelCommand. Inside xdelexCommand, the sibling function landed in PR #14130 by the same author in the same commit.
The fix did not require any analysis Redis maintainers had not already performed. The fix was the idiom.
This is Parallel Implementation Gap, in one file
The shape we name Parallel Implementation Gap is a capability implemented by parallel modules where the canonical modules import a security check from a shared template and the divergent module does not. The pattern's Drupal exhibit describes it: the base Sql/Condition is safe because it abstains from building IN-clauses out of array values, and the PostgreSQL override is unsafe because it has to. CVE-2026-9082 names the override.
CVE-2025-62507 is the same shape, this time inside one file. Six static_ids declarations in t_stream.c. Five with the heap-realloc check. One without. The canonical idiom is in the file five times over. The divergent function is the canonical idiom with two lines absent.
PR #14130 is an unusually clean exhibit because the divergence is internal to a single PR. The author touched two new functions. They typed the idiom correctly once, in xdelexCommand. They typed it incorrectly once, in xackdelCommand. The code review of the PR had the correctly-typed sibling in front of it, in the same file, and did not flag the divergence. Three months passed between merge and the CVE.
The vendor advisory credits Google Big Sleep, Google's LLM-based vulnerability research agent. A system that searches for boilerplate variations across a codebase is the kind of system that finds a function missing two lines that appear in five neighboring functions. The bug is the kind a structural comparator catches on its first pass. Redis's repetition of the same six-line idiom across t_stream.c is what made the bug findable; the absence of a STREAMID_VEC_INIT(static_ids, count) macro that hides the heap-realloc inside an expansion the developer cannot omit is what made the bug write-able in the first place.
The bug ships with the idiom
Five of six is what humans hit when the language gives them five chances. The defense against stack overflow in stream-ID parsing exists in t_stream.c as a six-line ritual the developer has to remember. Every new stream command added to Redis 8.x will have to remember it. When the next author of a new stream command forgets the two lines, the patch will be two lines, and the boilerplate the patch adds will already exist in the file.
PoC: GartonChan/redis-cve-2025-62507
The same PR added the bug and the fix. They live in different functions in the same file.