Closed c4-bot-4 closed 10 months ago
DadeKuma marked the issue as primary issue
DadeKuma marked the issue as sufficient quality report
lumtis marked the issue as disagree with severity
A panic in a message execution would not crash the chain, it would only make the message fail
lumtis (sponsor) disputed
0xean marked the issue as unsatisfactory: Invalid
0xean changed the severity to 2 (Med Risk)
0xean marked the issue as satisfactory
0xean marked issue #116 as primary and marked this issue as a duplicate of 116
0xean marked the issue as partial-25
Lines of code
https://github.com/code-423n4/2023-11-zetachain/blob/2834e3f85b2c7774e97413936018a0814c57d860/repos/node/x/observer/types/ballot.go#L27
Vulnerability details
Impact
During voting time, there may be a panic, or malicious nodes intentionally create panic to crash the chain.
Proof of Concept
The Ballot module returns -1 if the address of the ballot does not exist in the VoterList
The
HasVoted
function gets the Vote status directly usingm.votes[index]
after getting index, but if index is -1, the array is out of bounds.This is likely to happen anywhere voting is required. For example,
VoteOnObservedInboundTx
, the node votes onInboundTx
, which occurs if the node's address is added to the trust list after the vote is created.There are two cases as follows:
InboundTx
and starts to vote,however, the vote(Ballot) has already been created and the new address is not in theVoterList
, a panic occurs.Ballot
already created.The function call process is as follows: VoteOnObservedInboundTx -> AddVoteToBallot -> AddVote -> HasVoted
Tools Used
vscode manual
Recommended Mitigation Steps
Assessed type
DoS