The candidate's address is not initialized upon contract deployment, and there is no storage variable or method for setting it. This lack of implementation allows voters to cast their votes for any address, as there is no validation check, potentially leading to vote manipulation.
The function RankedChoice::_rankCandidates() updates the RankedChoice::s_rankings mapping without any candidate existence checks. This absence of validation allows voters to cast their votes for arbitrary addresses, which can lead to vote manipulation.
The vulnerability allows voters to cast votes for arbitrary addresses, which can lead to manipulation of voting results.
In the RankedChoiceTest.t.sol file, add the following code:
The test will pass even though Alice is not a candidate.
VS Code, Manual Review
Introduce a storage variable for the candidate's address and implement checks to validate candidate existence before updating the RankedChoice::s_rankings mapping.
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.