Description: The VotingBooth::vote
function closes the voting immediately after reaching 51% of voters, which gives an unfair advantage to those who managed to vote first.
It violates the voters' equal rights principle.
Bearing in mind that everyone wants to vote, it is possible to win with ~34% of voting power if there are 3 allowed voters, with 40% of voting power with 5 allowed voters, ~29% of voting power for 7 allowed voters, and finally ~33% of voting power for 9 allowed voters.
For example, imagine there are 5 voters. 2 of them want to vote "against", 3 of the them want to vote "for". If everyone has a possibility to vote, the "for" voters would win, because the have 60% of voting power. But in the current code implementation, if the 2 "against" voters vote first, they create 40% of quorum. If the next "for" voter votes, the quorum reaches 60%, which leads to closing the voting with 2 "against" votes, and 1 "for" vote. As a result, the outcome is not appropriate to what all voters want, which destroys democracy and justice.
This can have two outcomes:
The "for" voter can understand that his/her vote will reach the MIN_QUORUM
, and they will lose anyway, so the voter will not vote at all. It will stop the voting process.
The "for" voter will vote, but his/her vote will have no power.
Note This attack can be also implemented by frontrunning.
Impact: Voting can be closed in favor of those, who has lower voting power.
Proof of Concept:
All voters who has less voting power, but at least 33%, vote first.
Any other voters vote until reaching MIN_QUORUM
.
After reaching the MIN_QUORUM
, the first voters win.
Proof of Code:
Place the following into VotingBoothTest.t.sol
Recommended Mitigation: Remove the automatic voting closing after the MIN_QUORUM
has been reached. Add manual voting closure by anyone or a trusted creator after the specific publicly known deadline. Thus every voter's vote will matter.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.