redis/redis
Denial of Service (protocol desynchronization / client hang)
MEDIUM
The commit adds a guard in smembersCommand for set replies to detect a mismatch between the declared length (via addReplySetLen) and the actual number of elements sent. Previously, if a corrupted or mismatched length occurred (e.g., due to a corrupted dump, a bug in set iteration, or protocol desynchronization), the server could desynchronize the Redis protocol and cause the client to hang while waiting for more elements. The fix introduces a length counter initialized to the actual set size, decrements it as elements are sent, and asserts that the remaining length is zero after finishing. This prevents proceeding with a broken reply and turns a potential hang into a detectable failure (assert), mitigating a Denial-of-Service vector caused by protocol misbehavior. The change is accompanied by a test illustrating a corrupted-dump scenario that previously could hang the smembers response.
Impact: DoS via protocol desynchronization leading to client hang during SMEMBERS when dealing with a set reply whose length did not match the actual element count. The fix ensures mismatches are caught, avoiding a hang at the cost of a crash/assert in corrupted scenarios when built with assertions.
Commit: 74609d44
Affected: 8.6.0, 8.6.1 (any 8.6.x prior to the 8.6.2 patch); fixes applied in 8.6.2
2026-04-04 11:42