This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
web3pwn - Users might not be able to claim bribe rewards #110
Labels
Non-Reward
This issue will not receive a payout
web3pwn
Medium
Users might not be able to claim bribe rewards
Summary
The
claim
function of theBribeRewarder
contract can lead to denial of service if users delay claiming rewards for many periods or if there's a large gap between_startVotingPeriod
andendPeriod
. The function's loop through each period, including those without rewards, can cause out-of-gas errorsVulnerability Detail
The
claim
function of theBribeRewarder
contract allows users to claim bribe rewards for voting. The function loops from_startVotingPeriod
until the last finished period. This can cause issues if a user does not claim rewards for multiple periods after bribing finishes or if the difference between_startVotingPeriod
andendPeriod
is large enough to lead to a denial of service condition, as the_modify
function must be executed for periods where there is no reward.Issue Scenario 1:
BribeRewarder
has start and end periods set to 1-10 (10 periods).claim
function iterates from 1 to the last finished period (30), executing the_modify
logic for all of them.Issue Scenario 2:
BribeRewarder
has start and end periods set to 1-30 (30 periods)._modify
logic for each.Impact
User might be unable to claim accumulated bribe rewards.
Code Snippet
Tool used
Manual Review
Recommendation
It is recommended to add pagination to the
claim
function to allow users to claim partial rewards. In addition, the loop should be capped at the_lastVotingPeriod
.The text was updated successfully, but these errors were encountered: