Even after correcting the internal function call from _rankCandidates(orderedCandidates, signer) to _rankCandidates(orderedCandidates, msg.sender), the rankCandidatesBySig function still lacks additional signature verification. This means that the function does not validate the authenticity of the input signature, allowing any signature including fake or invalid ones to be used for casting votes. Consequently, voters might end up paying for the gas fees themselves, potentially damaging the credibility and reputation of both the protocol team and the sponsor
The rankCandidatesBySig function doesn't have secondary signature verification check apart from relying on the check in its internal function _rankCandidates which was found having an input parameter error. Even with the fix of the input parameter error, change from _rankCandidates(orderedCandidates, signer) to _rankCandidates(orderedCandidates, msg.sender), the signature will then be left unchecked as the signature is no longer being verified within the internal function itself.
The absence of signature authentic cause the rankCandidatesBySig function takes in any signatures inclusive of invalid signature and yet be able to execute casting voter's vote.
Proof of Concept:
Setup a HelperContract for ease of PoC to interact with various functions in contract RankedChoice and EIP712 during test case.
2.In test/RankedChoiceTest.t.sol, add the following test case
3.Run the test with forge test --match-test test_audit_signatureAutheticityIssue
The test passes showing that even with a fakeSignature, the function can be executed. And since the function is successfully executed fully, it would also mean that voter who make the function call will need to bear with the gas fee since the sponsor signature given is an invalid one.
Voter who makes the function call with rankCandidatesBySig will need to bear with the gas fee themselves when an invalid sponsor signature is used, leading to unexpected costs for the caller, who might not anticipate that the function is not handling sponsorship correctly.
Manual review with test
To add signature autheticity check on top of the fix with erroneous internal function
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.