Overwriting Votes:
Root Cause: Lack of restrictions on updating votes within the same term.
Scope: Affects only the current election term.
Impact: Voters can manipulate outcomes by changing their votes based on real-time data.
Signature Replay Attacks:
Root Cause: Absence of unique identifiers (like s_voteNumber
or nonces) in the signed data.
Scope: Allows reuse of signatures across different election terms.
Impact: Attackers can cast unauthorized votes in future elections using old signatures.
MEV Manipulation:
Root Cause: Miners' ability to control transaction ordering and inclusion.
Scope: External to the contract logic; depends on network-level factors.
Impact: Miners can include or exclude transactions to favor certain candidates.
Public Visibility of Votes:
Root Cause: Votes and voter choices are stored in plain text on-chain.
Scope: Anyone can access and analyze voting patterns in real-time.
Impact: Enables strategic voting and potential voter coercion based on visible data and person who pays for gas may chose his favourable candidates.
Voters are allowed to overwrite their votes by calling _rankCandidates
multiple times before the president is selected. This allows voters to change their votes based on real-time data, potentially manipulating the election outcome.
why MEV
Affected Function: _rankCandidates
Issue Explanation:
No Vote Finality: The contract does not prevent a voter from submitting multiple votes in the same voting round.
Strategic Voting: Voters can monitor the current standings and adjust their votes accordingly to influence the result.
Unfair Advantage: Voters who act last have an advantage over those who voted earlier.
Election Manipulation: The ability to change votes undermines the stability of the election process.
Unfairness: Early voters are disadvantaged compared to those who can react to ongoing results.
Manual Code Review: Observed lack of checks preventing multiple votes per voter per round.
Enforce Single Vote per Voter per Round:
Add a check in _rankCandidates
to ensure the voter hasn't already voted in the current round.
Implement Vote Finality:
Once a vote is cast, it should be immutable for that voting period.
Close Voting Before Selection:
Establish a voting deadline after which votes cannot be cast or changed before selectPresident
is called.
Event Logging:
Emit events when votes are cast to provide transparency.
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.