President Elector

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

L-1. Lack of zero address check after ECDSA.recover causing ,when signature is invalid, ability to vote for zero address

Summary

Vulnerability Details

The ecrecover function returns zero address when the signature is invalid.

Impact

Anyone can vote for zero address by calling RankedChoice.sol::rankCandidatesBySig

Tools Used

Recommendations

Add zero address check to the RankedChoice.sol::rankCandidatesBySig function.

function rankCandidatesBySig(address[] memory orderedCandidates, bytes memory signature) external {
bytes32 structHash = keccak256(abi.encode(TYPEHASH, orderedCandidates));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, signature);
+ if(signer == address(0)){
+ revert RankedChoice__InvalidVoter();
+ }
_rankCandidates(orderedCandidates, signer);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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