Lucene search

K
code423n4Code4renaCODE423N4:2022-06-YIELDY-FINDINGS-ISSUES-280
HistoryJun 26, 2022 - 12:00 a.m.

Sending batch withdrawal requests can possibly DoS

2022-06-2600:00:00
Code4rena
github.com
6

Lines of code

Vulnerability details

Impact

The function BatchRequests.sendWithdrawalRequests allows calling the sendWithdrawalRequests function on all of the Yieldy contracts at once. However, due to the unbounded for loop, if many Yieldy contracts are added to contracts, this function can potentially DoS due to reaching the block gas limit.

Proof of Concept

BatchRequests.sendWithdrawalRequests

function sendWithdrawalRequests() external {
    uint256 contractsLength = contracts.length;
    for (uint256 i; i < contractsLength; ) {
        if (
            contracts[i] != address(0) &&
            IStaking(contracts[i]).canBatchTransactions()
        ) {
            IStaking(contracts[i]).sendWithdrawalRequests();
        }
        unchecked {
            ++i;
        }
    }
}

Tools Used

Manual review

Recommended mitigation steps

Add offset and limit function parameters to implement a β€œpaginated” for loop.


The text was updated successfully, but these errors were encountered:

All reactions