Closed sherlock-admin closed 1 year ago
1 comment(s) were left on this issue during the judging contest.
tsvetanovv commented:
Invalid. We don't have an unbounded loop here. In the extreme case the admin will call the function again with a smaller array of tokens
Ragnark_323
high
Unbounded loop in
collectProtocol
function can leads to DOSSummary
unbounded loop in
collectProtocol
function can lead to Denail of ServiceVulnerability Detail
the
collectProtocol
function allows owner to collect protocol fees for multiple tokens and transfer them to a specified recipient.the loop inside this function iterate through array of tokens and calculate amount i.e protocol fees and ifamount>0
then it transfer the amount torecipient
address i.e the address of the recipient who will receive the collected fees and it tranfer's the amount by call's the IERC20'ssafeTransfer
function .with all this happening in the loop and costing gas and executing gas costly function likesafeTransfer()
for all tokens in this loop can leads to dos due to exceeding the block size gas limit.Impact
there can be many tokens that the loop have to go through and calculate the protocal fees and tranfering the protocol fees to recipient address in the loop by using gas costly executions like
safeTransfer()
can lead to fail of execution due to exceeding block size gas limitCode Snippet
LiquidityBorrowingManager.sol#ln184
Tool used
VS code
Recommendation
avoide all the actions executed in a single transaction, especially when transfer's are executed as part of a loop.