Repository navigation
[BFT-BUG] CRIT-BFT-2: PREPARE/COMMIT accept mismatched digests — equivocation attack - #2087
ArokyaMatthew wants to merge 1 commit into
Conversation
…vocation attack handle_prepare() and handle_commit() verify HMAC signatures but never check that msg.digest matches the digest from the PRE-PREPARE proposal. A Byzantine node can send PREPARE/COMMIT for a different digest than what the leader proposed, and it still counts toward quorum. This breaks the core PBFT safety guarantee: honest nodes could finalize a proposal that not all of them agreed on, or Byzantine nodes could vote for conflicting proposals simultaneously. Fix: After signature verification, compare msg.digest against pre_prepare_log[epoch].digest. Reject if they differ. Tests added (new file test_bft_digest_validation.py): - test_prepare_matching_digest_accepted - test_prepare_wrong_digest_rejected - test_commit_matching_digest_accepted - test_commit_wrong_digest_rejected - test_equivocation_cannot_reach_quorum All 5 tests pass. Bounty: Scottcjn#2819 (Critical, 200 RTC)
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
Good independent discovery, @ArokyaMatthew. The digest validation fix is correct. However, this overlaps with @createkr's #2082 which covers the same PREPARE/COMMIT digest validation plus additional hardening (TTL freshness checks, commit view validation, and quorum defense-in-depth filtering). Since #2082 is more comprehensive and touches the same code paths, I'm merging that one and closing this as duplicate. Payment: 25 RTC (independent discovery credit — you found the same BFT equivocation vector independently, which validates the severity) Closing in favor of #2082. |
Vulnerability Class
Critical — BFT equivocation via digest mismatch (200 RTC bounty)
The Bug
handle_prepare()andhandle_commit()verify HMAC signatures but never check thatmsg.digestmatches the PRE-PREPARE proposal's digest. Each handler stores whatever digest the remote peer sends and counts it toward quorum.Attack Vector
A Byzantine node sends PREPARE/COMMIT with a different digest than the leader's proposal:
This breaks the core PBFT safety invariant: all honest nodes in the quorum must agree on the same proposal content.
Fix
After signature verification in both handlers, compare msg.digest against pre_prepare_log[epoch].digest. Reject with a warning if they differ.
All 5 tests pass.
Files Changed
node/rustchain_bft_consensus.py — digest validation in handle_prepare() + handle_commit()
node/test_bft_digest_validation.py — NEW test file (5 tests)
Ref: Bounty #2819
Wallet: aroky-x86-miner