Unbounded for loops allows an attacker to freeze users' funds #240
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-11-bootfinance/blob/f102ee73eb320532c5a7c1e833f225c479577e39/vesting/contracts/Vesting.sol#L193-L205
At L195,
function claim()
will callfunction _claimableAmount()
, which includes an unbounded for loop.https://github.com/code-423n4/2021-11-bootfinance/blob/f102ee73eb320532c5a7c1e833f225c479577e39/vesting/contracts/Vesting.sol#L162-L188
An attacker can call
function vest()
and add a lot of very small amounts of new vestings to the user, if the length of the user's vestings is large enough, the gas cost offunction claim()
can exceed the block limit, making it impossible for the user to claim.Essentially, this allows an attacker to freeze (or burn, considering that the contract is not upgradable) the unclaimed funds of an arbitrary user.
Recommendation
Consider allowing users to
claim()
a specific range of vestings indexes.The text was updated successfully, but these errors were encountered: