Repository navigation
Reject corrupt stream RDB with shared NACK across consumers (CVE-2026-63639) - #4073
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis change adds a validation during RDB loading of stream consumer-group PEL entries and a regression test that verifies RESTORE rejects a dump corrupted to share one NACK across two consumers. ChangesRDB Stream NACK Corruption Check
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/rdb.c (1)
2852-2854: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a brief rationale comment for the new corruption case.
The existing comment above (lines 2849-2851) explains the happy-path assignment but not why a pre-set
nack->consumeris rejected (i.e., the use-after-free risk from a message ID shared across multiple consumers' PELs). A short inline note would make this non-obvious safety rationale clear to future readers.As per coding guidelines, "Use comments for non-obvious behavior and rationale, not for restating code."📝 Optional comment addition
+ /* A NACK must belong to exactly one consumer. If it's already + * assigned, the same message ID appears in multiple consumers' + * PELs, which would cause a dangling reference (use-after-free) + * once one consumer is deleted. Treat this as corruption. */ if (nack->consumer) { rdbReportCorruptRDB("NACK already assigned to a consumer, " "shared NACKs across consumers are not valid"); decrRefCount(o); return NULL; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/rdb.c` around lines 2852 - 2854, Add a brief inline rationale comment in the NACK corruption check within the consumer assignment logic around the nack->consumer guard, explaining that a pre-set consumer is rejected because sharing a message ID across multiple consumers’ PELs can lead to use-after-free risk. Keep the note short and tied to the existing corruption branch so future readers understand why rdbReportCorruptRDB is triggered here.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/rdb.c`:
- Around line 2852-2854: Add a brief inline rationale comment in the NACK
corruption check within the consumer assignment logic around the nack->consumer
guard, explaining that a pre-set consumer is rejected because sharing a message
ID across multiple consumers’ PELs can lead to use-after-free risk. Keep the
note short and tied to the existing corruption branch so future readers
understand why rdbReportCorruptRDB is triggered here.
0e2d4f7 to
a9f5b73
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #4073 +/- ##
============================================
+ Coverage 76.61% 76.78% +0.17%
============================================
Files 162 162
Lines 80694 81037 +343
============================================
+ Hits 61823 62224 +401
+ Misses 18871 18813 -58
🚀 New features to boost your workflow:
|
When loading a stream consumer group from RDB, the loader assigns each NACK's consumer pointer without checking if it was already claimed by a different consumer. A corrupt RDB payload can list the same message ID under multiple consumers' PELs, resulting in a shared NACK. This leads to use-after-free when one consumer is deleted while another still references the same NACK. Add a check that rejects the RDB if a NACK is already assigned to a different consumer. Same-consumer duplicates are still caught by the existing raxTryInsert check downstream. Signed-off-by: Saurabh Kher <[email protected]>
a9f5b73 to
14371b4
Compare
sarthakaggarwal97
left a comment
There was a problem hiding this comment.
Thanks, this looks good!
|
Can me and lifip get credited for finding and reporting the vulnerability? |
When loading a stream consumer group from RDB, the loader assigns each NACK's consumer pointer without checking if it was already set. A corrupt RDB payload can list the same message ID under multiple consumers' PELs, resulting in a shared NACK. This leads to use-after-free when one consumer is deleted while another still references the same NACK. Add a check that nack->consumer is NULL before assigning. If already set, reject the RDB as corrupt. Signed-off-by: Saurabh Kher <[email protected]>
…key-io#4073) When loading a stream consumer group from RDB, the loader assigns each NACK's consumer pointer without checking if it was already set. A corrupt RDB payload can list the same message ID under multiple consumers' PELs, resulting in a shared NACK. This leads to use-after-free when one consumer is deleted while another still references the same NACK. Add a check that nack->consumer is NULL before assigning. If already set, reject the RDB as corrupt. Signed-off-by: Saurabh Kher <[email protected]> Signed-off-by: Alon Arenberg <[email protected]>
…key-io#4073) When loading a stream consumer group from RDB, the loader assigns each NACK's consumer pointer without checking if it was already set. A corrupt RDB payload can list the same message ID under multiple consumers' PELs, resulting in a shared NACK. This leads to use-after-free when one consumer is deleted while another still references the same NACK. Add a check that nack->consumer is NULL before assigning. If already set, reject the RDB as corrupt. Signed-off-by: Saurabh Kher <[email protected]> Signed-off-by: Alon Arenberg <[email protected]>
When loading a stream consumer group from RDB, the loader assigns each NACK's consumer pointer without checking if it was already set. A corrupt RDB payload can list the same message ID under multiple consumers' PELs, resulting in a shared NACK. This leads to use-after-free when one consumer is deleted while another still references the same NACK.
Add a check that nack->consumer is NULL before assigning. If already set, reject the RDB as corrupt.