Anyone can immediately select the president after the first voter submits their choice of candidates, resulting in unfair selection of the president.
The vulnerability lies in L61-L64 of the contract.
The variable s_previousVoteEndTimeStamp
is not set upon contract deployment, resulting in a default value of 0. This means that anyone can immediately select the president after the first voter submits their choice of candidates, if the value of current block.timestamp
is greater than 126144000
.
For reference, the epoch timestamp of Thu, 19 Sep 2024 00:00:00 GMT is 1726704000
, which is easily greater than 126144000
, making this vulnerability highly possible.
Anyone can call the selectPresident
function after the first voter submits their choice of candidates, resulting in unfair selection of the president.
Foundry, manual review
To mitigate this vulnerability, the variable s_previousVoteEndTimeStamp
should be set to current block.timestamp
during contract deployment.
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.