Skip to content

Commit f309235

Browse files
committed
Reject a proposal whose proof-of-lock round is malformed
A Prop's round r and proof-of-lock round vr are decoded from the wire and were passed to the engine unchecked. A Byzantine proposer for round r could sign a Prop with vr >= r, violating the consensus state machine's prevote-previous precondition (it asserts vr < proposal round) and aborting the process. Drop a Prop unless r is a real round and vr is nil or below r. Found by auditing every malachite assert reachable from the API this node drives; this and the behind-vote-Invalid crash were the only app-reachable abort preconditions hyle could violate.
1 parent e7d9810 commit f309235

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/services/runtime.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,11 @@ void Runtime::on_message(const PubKey& src, MsgType type, wire::View payload) {
467467
} catch (const wire::Error&) {
468468
return;
469469
}
470+
// Rounds come off the wire. r must be a real round, and the proof-of-lock round vr must be nil
471+
// (-1) or strictly below r. A crafted vr >= r would violate the consensus state machine's
472+
// prevote-previous precondition (it asserts vr < proposal round) and abort the process. A signed
473+
// but malformed Prop from a Byzantine proposer is dropped here, not fed to the engine.
474+
if (r.value < 0 || vr.value < -1 || vr.value >= r.value) return;
470475

471476
{
472477
const malachite::ValidatorSet vs = node_.validators_for(h == 0 ? 1 : h);

0 commit comments

Comments
 (0)