Repository navigation
MOD-13409 Harden RDB loading - #1038
Conversation
* MOD-13409 Validate Bloom RDB bitset size on load Reject crafted module payloads where the loaded bloom bitset buffer length does not match the declared bits/n2, and add a flow regression test covering RESTORE with a corrupted DUMP payload. * MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Validate Bloom RDB bitset length on load Reject crafted module payloads where persisted bits do not match the loaded bitset buffer length, preventing OOB access after RESTORE.
* MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Harden CF RDB load buffer validation Replace assert-only checks in CFRdbLoad with explicit validation of loaded sizes and ranges, and add a flow test that corrupts a CF DUMP payload to ensure RESTORE is rejected. * MOD-13409 Harden remaining RDB loaders (TDigest) TDigest RDB loading trusted attacker-controlled cap, which could desync the allocated centroid arrays from the loaded metadata and enable OOB access after RESTORE. Reject payloads where loaded cap differs from the allocated cap derived from compression, validate node counters, and add a flow regression that corrupts a TDigest DUMP payload and asserts RESTORE is rejected. With the earlier BF/CF fixes, this covers all remaining module data structures that load raw buffers from RDB/RESTORE (CMS/TopK already validate buffer sizes). * Revert "MOD-13409 clang-format rebloom.c" This reverts commit 456e53503f51b68c4d7a9df988e50a36adf2e61a.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cf8e805. Configure here.
| _lzf_decompress(comp, ulen) | ||
| pos = comp_end | ||
| continue | ||
| raise RuntimeError(f"Unknown module opcode {opcode} at pos={pos}") |
There was a problem hiding this comment.
Test parser missing SINT opcode for TDigest format
Medium Severity
_corrupt_dump_set_first_uint_after_3_doubles only handles opcodes EOF (0), UINT (2), DOUBLE (4), and STRING (5). TDigest saves cap via RedisModule_SaveSigned, which emits MODULE_OPCODE_SINT (opcode 1). After encountering 3 doubles in the TDigest stream, the parser hits opcode 1 (SINT for cap) and raises RuntimeError because it's unrecognized, causing test_restore_rejects_corrupted_tdigest_cap to crash during payload construction rather than testing the actual validation logic.
Reviewed by Cursor Bugbot for commit cf8e805. Configure here.
| value += _module_uint(declared) | ||
| value += _module_uint(declared) | ||
| value += _module_uint(0) | ||
| value += _module_uint(0) |
There was a problem hiding this comment.
P88W test payload uses wrong opcode type
Low Severity
_build_p88w_first_restore_payload uses _module_uint (emitting RDB_MODULE_OPCODE_UINT = 2) for the cap, merged_nodes, unmerged_nodes, and total_compressions fields. TDigest's loader reads these with RedisModule_LoadSigned, which expects MODULE_OPCODE_SINT (1). The payload gets rejected due to opcode mismatch rather than the new cap-validation logic, so the test doesn't verify the hardening fix it claims to cover.
Reviewed by Cursor Bugbot for commit cf8e805. Configure here.
Avoid signed overflow when validating merged and unmerged node counts by widening the addition.
|
* MOD-13409 Validate Bloom RDB bitset size on load (#126) * MOD-13409 Validate Bloom RDB bitset size on load Reject crafted module payloads where the loaded bloom bitset buffer length does not match the declared bits/n2, and add a flow regression test covering RESTORE with a corrupted DUMP payload. * MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Validate Bloom RDB bitset length on load Reject crafted module payloads where persisted bits do not match the loaded bitset buffer length, preventing OOB access after RESTORE. * Mod 13409 rdb hardening (#127) * MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Harden CF RDB load buffer validation Replace assert-only checks in CFRdbLoad with explicit validation of loaded sizes and ranges, and add a flow test that corrupts a CF DUMP payload to ensure RESTORE is rejected. * MOD-13409 Harden remaining RDB loaders (TDigest) TDigest RDB loading trusted attacker-controlled cap, which could desync the allocated centroid arrays from the loaded metadata and enable OOB access after RESTORE. Reject payloads where loaded cap differs from the allocated cap derived from compression, validate node counters, and add a flow regression that corrupts a TDigest DUMP payload and asserts RESTORE is rejected. With the earlier BF/CF fixes, this covers all remaining module data structures that load raw buffers from RDB/RESTORE (CMS/TopK already validate buffer sizes). * Revert "MOD-13409 clang-format rebloom.c" This reverts commit 456e53503f51b68c4d7a9df988e50a36adf2e61a. * MOD-13409 Add regression for published P88W exploit * MOD-13409 Share RDB corruption test helpers * Fix TDigest RDB load node count overflow check Avoid signed overflow when validating merged and unmerged node counts by widening the addition.
* MOD-16514 - fix the bootstrap and build (#1028) * install aws if and only if it is not installed yet * add another build fixes * fix build for amazonlinux2 * fix(al2): add cc symlink to devtoolset-11 to fix LTO version mismatch * alma8 +rhel8+rhel9+bionic +focal passes * fix for bionic * fix * bump rltest * fix bionic bootstrap * fix azurelinux3 * bionic fix * fix for bullesye * fix focal ci * fix the test due to bump rltest version * fix for bionic and focal * fix * fix remarks * try another methood (#1030) * MOD-16871: replicate in `cfInsertCommon` after `cfCreate` in case of errors (#1034) * MOD-16871: relicate in after * . * MOD-16306 - pull docker images from registry (#1036) * MOD-16306 - pull docker images from registry * cherry pick changes to bloom * MOD-13409 Harden RDB loading (#1038) * MOD-13409 Validate Bloom RDB bitset size on load (#126) * MOD-13409 Validate Bloom RDB bitset size on load Reject crafted module payloads where the loaded bloom bitset buffer length does not match the declared bits/n2, and add a flow regression test covering RESTORE with a corrupted DUMP payload. * MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Validate Bloom RDB bitset length on load Reject crafted module payloads where persisted bits do not match the loaded bitset buffer length, preventing OOB access after RESTORE. * Mod 13409 rdb hardening (#127) * MOD-13409 clang-format rebloom.c Run clang-format on rebloom.c to satisfy make lint formatting checks. * MOD-13409 Harden CF RDB load buffer validation Replace assert-only checks in CFRdbLoad with explicit validation of loaded sizes and ranges, and add a flow test that corrupts a CF DUMP payload to ensure RESTORE is rejected. * MOD-13409 Harden remaining RDB loaders (TDigest) TDigest RDB loading trusted attacker-controlled cap, which could desync the allocated centroid arrays from the loaded metadata and enable OOB access after RESTORE. Reject payloads where loaded cap differs from the allocated cap derived from compression, validate node counters, and add a flow regression that corrupts a TDigest DUMP payload and asserts RESTORE is rejected. With the earlier BF/CF fixes, this covers all remaining module data structures that load raw buffers from RDB/RESTORE (CMS/TopK already validate buffer sizes). * Revert "MOD-13409 clang-format rebloom.c" This reverts commit 456e53503f51b68c4d7a9df988e50a36adf2e61a. * MOD-13409 Add regression for published P88W exploit * MOD-13409 Share RDB corruption test helpers * Fix TDigest RDB load node count overflow check Avoid signed overflow when validating merged and unmerged node counts by widening the addition. * MOD-16952 - enhance bootstrap (add list and dry-run arg) (#1037) * add bootstrap dry-run and chrck-deps * remove dry-run * write list to afile * add optional deps * add another optional deps * add another optional deps * add versioning managment * rename command to list * renme to list * add dry run * fix colors * fix bloom missing deps only for dry run * fix missing * remove min cmake version * fix remarks * fix remarks * fix remarks * fix remarks * fix remarks * add _sh so we can have the full bootstrap output * always return to the workspace dir * make single copy paste install all * fix alma8 * fix bad dry-run print * gaurd tool-set version 11 * fix curl minimal * remove centos-release-scl for amazonlinux2 * fix macos env * fix(bootstrap): make sudo a no-op on root containers without a sudo binary The install scripts run privileged steps via literal `sudo` inside `_sh` command strings (e.g. `sudo ln -sf ...`, `| sudo tee`, `&& sudo make install`). On a slim Docker image that runs install_script.sh directly as root with no `sudo` package installed (e.g. RedisTimeSeries' amazonlinux2 CI), those steps fail with `sudo: command not found` (exit 127), aborting the whole bootstrap. Add a root-only pass-through in pm.sh/deps_lib.sh: when running as root and no real `sudo` binary exists, define `sudo()` to run its arguments directly. When not root, a missing sudo stays a genuine error and is left unmasked. * bump version to 8.10.0 --------- Co-authored-by: Aviv David <[email protected]> Co-authored-by: Tom Gabsow <[email protected]>
## Module Update This PR bumps the pinned **MODULE_VERSION** for **RedisBloom** from **v8.9.90** to **v8.10.0**. RedisTimeSeries and RedisJSON are unchanged. ## Changes | Module | From | To | | -- | -- | -- | | RedisBloom | v8.9.90 | v8.10.0 | **Note:** this RedisBloom range contains 4 relevant commits. The main fixes are Cuckoo-filter replication correctness, GHCR-based CI Docker image reuse, RDB/RESTORE hardening, and bootstrap list / dry-run support. ## Module Changes [RedisBloom range](RedisBloom/RedisBloom@v8.9.90...v8.10.0) - MOD-16871 - replicate CF.ADD / CF.INSERT autocreated keys before early error returns, preventing master/replica key-existence divergence ([#1034](RedisBloom/RedisBloom#1034)) - MOD-16306 - pull prebuilt RedisBloom CI Docker images from GHCR and fall back to local builds only when needed ([#1036](RedisBloom/RedisBloom#1036)) - MOD-13409 - harden BF, CF, and TDigest RDB loading against crafted RESTORE payloads that could cause metadata/buffer desync and OOB access ([#1038](RedisBloom/RedisBloom#1038)) - MOD-16952 - enhance bootstrap with `make bootstrap list` and `make bootstrap dry-run`, plus fixes for root containers without sudo ([#1037](RedisBloom/RedisBloom#1037)) ## Excluded Commits **0 commits excluded** All 4 listed commits are part of the requested RedisBloom update set. ## Verification - [ ] CI passes for RedisBloom at the new pinned version - [ ] `make all` builds RedisBloom cleanly against unstable - [ ] Module tests run under `make test` --- *This PR was automatically created by the Redis Module Release Orchestrator.* <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Single-version manifest pin with no Redis core or security-path changes; risk is limited to RedisBloom behavior in the new upstream release. > > **Overview** > Pins the bundled **RedisBloom** module to upstream tag **`v8.10.0`** in `modules/modules.yaml` (was **`v8.9.90`**). That manifest drives `make modules-update`, Docker bundled-module installs, and release tarballs, so builds and packaging will pull the new RedisBloom release. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ac37b83. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>





Summary
Testing
gmake buildNote
High Risk
Changes deserialization of untrusted RESTORE/RDB module data—a prior exploit class (P88W)—with stricter rejection paths; regressions could break legitimate snapshots or leave edge-case payloads accepted.
Overview
Hardens module RDB/RESTORE loading so crafted DUMP payloads cannot desync metadata from allocated buffers or trigger out-of-bounds access.
Bloom loading now rejects null/empty bitset buffers, enforces exact bit-buffer size for newer encodings, and validates
n2and related bit geometry beforebloom_validate_integrity. Cuckoo loading boundsnumFilters, bucket counts, and uint16 fields, runsCuckooFilter_ValidateIntegritybefore allocation, and replaces asserts with checks that sub-filter blob length matchesbucketSize × numBuckets. TDigest loading requires loadedcapto match whattd_newallocated and tightens merged/unmerged node counter bounds before reading node arrays.Tests add shared
rdb_corruption_utilsfor DUMP/CRC rewriting, expand corrupt-RESTORE coverage for Bloom (shrunk bitset, hugenfilters), Cuckoo (shrunk buffer), and TDigest (inflated cap plus a P88W exploit-shaped payload), and dedupe TopK corruption helpers onto the shared module.Reviewed by Cursor Bugbot for commit f756a66. Bugbot is set up for automated code reviews on this repo. Configure here.