Open code423n4 opened 3 years ago
The VotePack
struct contains a bool
indicating whether there was support for a proposal or not and the validateVoteHash
function hashes all submitted votes meaning that it is not possible to obscure the for and against votes as they can be calculated off-chain.
In any case, this is purely an off-chain utility function and as such, the severity should be reduced to non-critical (0).
Labeling this as non-critical as validateVoteHash
is an external function.
Handle
cmichel
Vulnerability details
Vulnerability Details
The
validateVoteHash
function only checks if the individual voting power (conviction score) is indeed correct, but it does not verify if the outcome of the vote is correct, i.e., it's possible for a guardian to submit completely differentforVotes
/againstVotes
in__castOffchainVotes
changing the proposal outcome.Impact
The guardian needs to be trusted to submit the correct
forVotes
andagainstVotes
such that they match the votes in thevoteHash
. The issue is that this cannot be easily verified.Legitimate users can be tricked into thinking the result is correct by checking if their vote & support is contained in
votes
and recomputing thevoteHash
themselves. They then callvalidateVoteHash
which "confirms" the guardian result. However, in reality, the guardian could have submitted arbitraryforVotes
/againstVotes
values.This makes the current validation system kind of useless.
Recommended Mitigation Steps
Sum up the for/against votes in the
votes
array ofvalidateVoteHash
and check if it matches theproposal.forVotes/againstVotes
.