The rankCandidates
function does not implement a validation check to ensure that the orderedCandidates
array contains unique candidate addresses. This oversight allows candidates to be ranked multiple times, which could unfairly influence the ranking outcome, resulting in manipulation of the voting or ranking system.
The rankCandidates
function takes an array of candidate addresses, orderedCandidates
, and calls the _rankCandidates
function with it. However, there is no logic to ensure that the addresses in the array are unique. As a result, the same candidate address can appear multiple times, leading to a skewed ranking process. This issue can be exploited by submitting duplicate candidate addresses to boost a candidate’s ranking position or affect the fairness of the overall ranking.
An attacker can submit the same candidate address multiple times in the array, for example:
In this case, candidateA is ranked twice, which may affect the ranking calculation and unfairly promote this candidate over others.
Allowing duplicates in the ranking system introduces the risk of manipulation, where specific candidates can be unfairly promoted more than intended. Malicious actors could exploit this flaw by submitting the same candidate multiple times, undermining the integrity of the ranking process.
Manual code review.
Add Validation for Duplicate Candidates. Implement logic to ensure that the orderedCandidates
array contains unique addresses before passing them to the _rankCandidates
function.
Revert on Duplicate Entries. Use a mapping or set to track candidates that have already been ranked and revert the transaction if a duplicate is found.
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.