Lack of upperbound on iterated array rewardTokens
in AuraLocker
#265
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L195-L202
Vulnerability details
Impact
There is no upper bound on the size of the array
rewardTokens
inAuraLocker
.Since this array is iterated in multiple locations such as
updateReward()
,getReward()
,claimableRewards()
it is possible to end up in a state where there are too many reward tokens such that the contract cannot be iterated over them within the block gas limit.The impact is that no rewards will be able to be withdrawn from the contract since the array
rewardTokens
is required to be iterated over in order to withdraw rewards.This issue is rated Medium rather than High since
addReward()
which increases the size of this array is controlled via the DAO.Proof of Concept
There are no restrictions on the number of tokens that can be pushed to
rewardTokens
inaddReward()
.Recommended Mitigation Steps
Consider having a configurable upper bound that is set by the DAO to prevent accidental increase in the number of rewards tokens to a point where they cannot be iterated in the block gas limit.
The text was updated successfully, but these errors were encountered: