President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Lack of Restriction or Identity Validation for Candidate Uniqueness

Summary

The RankedChoice smart contract does not implement any restrictions or validation mechanisms to ensure that each candidate in the election is unique. This lack of identity verification could result in multiple entries for the same candidate, compromising the integrity of the election and leading to potential vote splitting or manipulation.

Vulnerability Details

In the RankedChoice contract, the process of candidate ranking and selection is based on the assumption that all candidates are distinct. However, the contract does not contain any checks to verify the uniqueness of candidates in the voting process. This means that the same candidate could be entered into the candidate list multiple times, either intentionally or due to a mistake, and be treated as separate entities.

if (!_isInArray(s_candidateList, orderedCandidates[j])) {
s_candidateList.push(orderedCandidates[j]);
}

In this snippet, candidates are added to the s_candidateList if they are not already present. However, there is no validation to ensure that the candidate addresses are valid or unique beyond the simple array check, which might not catch more complex cases of candidate duplication.

Impact

Without a validation mechanism, there is a risk that a single candidate could appear multiple times in the ranked lists or in the tallying process. This could result in the votes intended for a single candidate might be split across multiple entries, reducing their chances of being selected as the winner or malicious actors could exploit this lack of validation by duplicating candidate entries to manipulate the outcome of the election in their favor.

Tools Used

Manual Review

Recommendations

Introduce a validation mechanism during the ranking and voting process to ensure that each candidate is unique. This can be done by checking if the candidate's address has already been entered before adding them to the candidate list.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

rankCandidates() allows duplicate votes inside the `orderedCandidates` array

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

rankCandidates() allows duplicate votes inside the `orderedCandidates` array

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.