The contract contains a vulnerability that can lead to a Denial of Service (DoS) attack. This issue arises due to the contract iterating over a large number of voters in the selectPresident
function, which may cause the transaction to run out of gas, preventing the contract from executing as intended.
The vulnerability lies in L68 and L107 of the contract.
As the number of VOTERS
is not bounded, running the loops in L68 and L107 of the selectPresident
and _selectPresidentRecursive
functions respectively would lead to a DoS attack due to excessive gas consumption, causing the function to fail.
Deployer initializes a large number of VOTERS
during contract deployment.
When the selectPresident
function is executed, it leads to a DoS attack, and the function fails to execute.
The vulnerability would lead to users not being able to call the selectPresident
function successfully.
Foundry, manual review
To mitigate the vulnerability, the contract can be updated to use a batch voting system where the votes are processed in batches rather than in single 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.