The MartenitsaVoting::announceWinner function has a vulnerability where it does not properly handle the case when multiple MartenitsaTokens have an equal number of votes. The function is only accurate when one of the MartenitsaTokens has a strictly higher number of votes compared to the others.
The MartenitsaVoting::announceWinner function is designed to determine the winning MartenitsaToken based on the number of votes each token has received. However, the current implementation does not consider the scenario where two or more tokens have the same number of votes.
In the case of a tie, the function will arbitrarily select one of the tokens with the highest vote count as the winner, rather than properly handling the tie situation. This can lead to inconsistent and unfair results, as the true winner may not be accurately determined.
The vulnerability in the MartenitsaVoting::announceWinner function can have the following impacts:
Incorrect Winner Selection: In the event of a tie, the function may select a winner arbitrarily, leading to an incorrect or unfair outcome. This can undermine the integrity and fairness of the voting process.
Loss of Trust: If users become aware of the vulnerability and the potential for incorrect winner selection, it can erode trust in the voting system. Users may question the reliability and accuracy of the results, leading to a loss of confidence in the platform.
Manual Review
Add a check for equal number of votes to the announceWinner()
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.