Description: The rankCandidates
function allows users to submit an ordered list of candidate addresses without validating the uniqueness or validity of these addresses. This means that a voter can submit a list with duplicate addresses or addresses that are not valid candidates.
Impact:
Skewed Voting Results: Voters can unfairly influence the election by ranking the same candidate multiple times, effectively giving them more weight in the election process.
Invalid Candidates: Addresses that are not valid candidates can be included in the rankings, potentially disrupting the election process and results.
Proof of Concept: A voter could call the rankCandidates
function with a list like [candidate1, candidate1, candidate2]
, which would unfairly give more weight to candidate1
:
Recommended Mitigation:
Uniqueness Check: Implement a mechanism to ensure that all addresses in orderedCandidates are unique. This can be done using a mapping to track the presence of each address.
Validity Check: Ensure that all addresses in orderedCandidates are valid candidates. This could involve maintaining a list or mapping of valid candidates and checking against it.
Example Mitigation Code
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.