A user can stake for another user and create new checkpoints, which can be exploited by an attacker to perform a DOS attack on the voting mechanism for any staker
If the amount is non-zero, an attacker can deposit for any user _for
and create new checkpoints
If block.number
is different from the previous block, it creates new checkpoint.
As stated in the documentation, the contract supports every EVM chain, and some L2s may have a lower block gas limit, such as zksync-era etc. An attacker can use this vulnerability to DoS the original user from voting. Although the binary search is highly optimized, if the block gas limit is low, even 25-30 iterations of the while loop will cause the transaction to revert due to an out-of-gas error
Since even a 1 wei amount can be deposited and the gas fees on L2 are low, the attack cost is minimal, making it feasible if the attacker stands to gain by preventing the original users from voting.
A user who holds majority of totalSupply can be prevented from voting mechanism since getPriorVotes(address account, uint256 blockNumber)
will revert due to OOG error.
Attacker can prevent user from voting
Manual
mplement a minimum stake value that can be staked via stakeFor
, which will increase the attack cost and make the attack unprofitable for the attacker.
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.