Repository navigation
fix(cluster): validate MOVED slot to prevent Array.prototype pollution - #2151
Merged
PavelPashov merged 2 commits intoJul 29, 2026
Merged
Conversation
The Cluster MOVED handler used the slot token from the redirect error message directly as an index into the internal `slots` array without validating it. A malicious or compromised node (or a MITM/DNS-poisoning position) replying with `-MOVED __proto__ host:port` caused `this.slots["__proto__"]` to resolve to `Array.prototype`, and the subsequent `this.slots[slot][0] = key` wrote to `Array.prototype[0]`, polluting every array in the process. Validate that the slot is an integer in the cluster range [0, 16383] before using it. Malformed redirects are rejected with the original error instead of being applied. This is a variant of the previously fixed hgetall prototype pollution (redis#1267) that was never applied to the MOVED code path. Ref: https://hackerone.com/reports/3761875 Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bd22aae08
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Move the slot validation into the shared `handleError` boundary so both the single-command and pipeline MOVED handlers are protected, and pass the parsed numeric slot to the handlers. The pipeline retry path had its own MOVED handler that indexed `cluster.slots[errv[1]]` with the raw token, bypassing the earlier fix (a "__proto__" token polluted Array.prototype and a "length" token threw RangeError). Add a pipeline regression test alongside the single-command one. Ref: https://hackerone.com/reports/3761875 Addresses Codex review feedback on redis#2151. Co-Authored-By: Claude Fable 5 <[email protected]>
PavelPashov
approved these changes
Jul 28, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 29, 2026
# [6.0.0-beta.1](v5.11.1...v6.0.0-beta.1) (2026-07-29) * Add RESP3 ([#2127](#2127)) ([5d0862e](5d0862e)) ### Bug Fixes * clear stale socket timeout on reconnect ([#2148](#2148)) ([6455dbe](6455dbe)) * **cluster:** recreate stale connection on circular MOVED ([#2135](#2135)) ([08c8967](08c8967)) * **cluster:** validate MOVED slot to prevent Array.prototype pollution ([#2151](#2151)) ([9618206](9618206)), closes [#1267](#1267) * **command:** serialize large integer arguments in decimal notation ([#2136](#2136)) ([09b8d04](09b8d04)) * **redis:** keep reconnecting when connection closes during client setup ([#2099](#2099)) ([#2123](#2123)) ([f9a66bc](f9a66bc)) * **sentinel:** preserve zero preferred slave priority ([#2129](#2129)) ([a3f9f2d](a3f9f2d)) * **tracing:** redact values for GETSET and PSETEX ([#2134](#2134)) ([832765d](832765d)) ### Features * add LMOVEM and BLMOVEM command support ([#2144](#2144)) ([c26af46](c26af46)) * add Redis 8.10 set cardinality commands ([#2143](#2143)) ([301099b](301099b)) * support MAXCOUNT and MAXSIZE for stream reads ([#2142](#2142)) ([ae5e41b](ae5e41b)) ### BREAKING CHANGES * ioredis now requires Node.js 20 or newer and uses RESP3 by default. Set `protocol: 2` to retain the v5 wire protocol.
|
🎉 This PR is included in version 6.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 31, 2026
# [6.0.0](v5.11.1...v6.0.0) (2026-07-31) * Add RESP3 ([#2127](#2127)) ([5d0862e](5d0862e)) ### Bug Fixes * clear stale socket timeout on reconnect ([#2148](#2148)) ([6455dbe](6455dbe)) * **cluster:** recreate stale connection on circular MOVED ([#2135](#2135)) ([08c8967](08c8967)) * **cluster:** validate MOVED slot to prevent Array.prototype pollution ([#2151](#2151)) ([9618206](9618206)), closes [#1267](#1267) * **command:** serialize large integer arguments in decimal notation ([#2136](#2136)) ([09b8d04](09b8d04)) * **redis:** keep reconnecting when connection closes during client setup ([#2099](#2099)) ([#2123](#2123)) ([f9a66bc](f9a66bc)) * **sentinel:** preserve zero preferred slave priority ([#2129](#2129)) ([a3f9f2d](a3f9f2d)) * **tracing:** redact values for GETSET and PSETEX ([#2134](#2134)) ([832765d](832765d)) * **types:** export ScanStreamOptions, RedisStatus and ClusterStatus ([#2158](#2158)) ([cf3bf71](cf3bf71)) ### Features * add LMOVEM and BLMOVEM command support ([#2144](#2144)) ([c26af46](c26af46)) * add Redis 8.10 set cardinality commands ([#2143](#2143)) ([301099b](301099b)) * himport managed fieldsets ([#2159](#2159)) ([729f174](729f174)) * improve default connection resilience ([#2160](#2160)) ([6d0716e](6d0716e)) * support MAXCOUNT and MAXSIZE for stream reads ([#2142](#2142)) ([ae5e41b](ae5e41b)) ### BREAKING CHANGES * ioredis now requires Node.js 20 or newer and uses RESP3 by default. Set `protocol: 2` to retain the v5 wire protocol.
|
🎉 This PR is included in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
stxkxs
added a commit
to nanohype/slack-knowledge-bot
that referenced
this pull request
Aug 18, 2026
ioredis 5.10.1 → 6.0.0. Two breaking changes in the release, both checked against what this service actually does rather than accepted on faith. ─── Node floor ─── 6.0 requires Node >= 20. This repo declares `engines.node: ">=24"`, runs `node:24-alpine` in the Dockerfile and Node 24 in CI. Clear. ─── RESP3 by default ─── The real change: 6.0 negotiates RESP3 unless `protocol: 2` is set. RESP3 reshapes some replies from flat arrays into maps, which would silently break parsing rather than fail loudly, so the question is which commands this service issues. All of them, and only these: ZREMRANGEBYSCORE, ZCARD, ZADD and EXPIRE — the sliding-window rate limiter's pipeline, the complete Redis surface behind `RedisPipelinePort` in `src/ratelimit/redis-limiter.ts`. Every one replies with an integer under both protocols, and `pipeline().exec()` keeps its `[err, result]` tuple shape. The commands RESP3 actually reshapes — CONFIG GET, HGETALL, XPENDING and friends — are not ones this service issues, and the narrow port is what makes that a bounded claim rather than a hopeful one: nothing can reach the client except through those four methods. So the default is kept rather than pinned back to `protocol: 2`. Taking a major and immediately disabling its headline change would be adopting the version number without the version. The reasoning is recorded in `src/redis.ts` next to the client options, along with the escape hatch, for whoever meets a cache that cannot speak RESP3. Also picks up an Array.prototype pollution fix in the cluster MOVED handler (redis/ioredis#2151) and a stale-socket-timeout fix on reconnect (#2148), neither of which this service was exposed to — single-node client, no cluster. Gate: 212 tests pass, typecheck / lint / format clean, `npm audit --audit-level=high --omit=dev` reports 0 vulnerabilities. Co-authored-by: stxkxsbot <[email protected]>
stxkxs
added a commit
to nanohype/slack-knowledge-bot
that referenced
this pull request
Aug 18, 2026
ioredis 5.10.1 → 6.0.0. Two breaking changes in the release, both checked against what this service actually does rather than accepted on faith. ─── Node floor ─── 6.0 requires Node >= 20. This repo declares `engines.node: ">=24"`, runs `node:24-alpine` in the Dockerfile and Node 24 in CI. Clear. ─── RESP3 by default ─── The real change: 6.0 negotiates RESP3 unless `protocol: 2` is set. RESP3 reshapes some replies from flat arrays into maps, which would silently break parsing rather than fail loudly, so the question is which commands this service issues. All of them, and only these: ZREMRANGEBYSCORE, ZCARD, ZADD and EXPIRE — the sliding-window rate limiter's pipeline, the complete Redis surface behind `RedisPipelinePort` in `src/ratelimit/redis-limiter.ts`. Every one replies with an integer under both protocols, and `pipeline().exec()` keeps its `[err, result]` tuple shape. The commands RESP3 actually reshapes — CONFIG GET, HGETALL, XPENDING and friends — are not ones this service issues, and the narrow port is what makes that a bounded claim rather than a hopeful one: nothing can reach the client except through those four methods. So the default is kept rather than pinned back to `protocol: 2`. Taking a major and immediately disabling its headline change would be adopting the version number without the version. The reasoning is recorded in `src/redis.ts` next to the client options, along with the escape hatch, for whoever meets a cache that cannot speak RESP3. Also picks up an Array.prototype pollution fix in the cluster MOVED handler (redis/ioredis#2151) and a stale-socket-timeout fix on reconnect (#2148), neither of which this service was exposed to — single-node client, no cluster. Gate: 212 tests pass, typecheck / lint / format clean, `npm audit --audit-level=high --omit=dev` reports 0 vulnerabilities. Co-authored-by: stxkxsbot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request fixes a prototype pollution vulnerability in the Cluster MOVED redirect handler.
The bug:
Cluster#handleErrorsplits the RESP error string and passes the slot token straight into themovedhandler, which used it as an index into the internalslotsarray without validation:slotsis initialized as[]. A malicious or compromised cluster node — or an attacker in a MITM / DNS-poisoning position — replying with-MOVED __proto__ host:portmakes_this.slots["__proto__"]resolve toArray.prototype(truthy), so_this.slots[slot][0] = keywrites toArray.prototype[0], polluting every array in the process.This is a variant of the previously fixed
hgetallprototype pollution (#1267) that was never applied to the MOVED code path.The fix: validate the slot is an integer in the cluster range
[0, 16383]before using it as an index. Malformed redirects are rejected with the original error instead of being applied, so no attacker-controlled value can reachslots[...].Behavior change: a MOVED reply with a non-numeric or out-of-range slot is now rejected rather than acted on. Well-behaved Redis Cluster servers always send an integer slot, so legitimate traffic is unaffected.
Ref: https://hackerone.com/reports/3761875
Note
High Risk
Security fix in cluster redirect handling that prevents global prototype pollution from untrusted MOVED replies; behavior change only for malformed/out-of-range slots.
Overview
Fixes a prototype pollution vulnerability when handling Redis Cluster
MOVEDredirects. A malicious node (or MITM) could reply withMOVED __proto__ host:port; the client used the slot token as an array index on the internalslotstable ([]), which madeslots["__proto__"]resolve toArray.prototypeand allowed writes likeArray.prototype[0].Cluster#handleErrornow parses the slot withNumber(), requires an integer in[0, 16383], and callshandlers.defaults()(surface the original error) when validation fails. Valid slots are passed as anumberintomovedhandlers instead of the raw string token.Pipeline’s inlinemovedcallback is updated to use that numericslotwhen updatingcluster.slotsand_groupsBySlot(replacing incorrecterrv[1]references).Functional tests cover crafted
MOVED __proto__for single commands and pipelines, assertingArray.prototypeis not polluted.Reviewed by Cursor Bugbot for commit b7a01d9. Bugbot is set up for automated code reviews on this repo. Configure here.