Skip to content
DoS Audit finding Intermediate

Sending batch withdrawal requests can possibly DoS

The batch withdrawal function loops over an unbounded list of contracts, so if many contracts are added, the transaction can exceed the block gas limit and fail. An attacker could potentially cause a denial of service by making the list too large, though only the owner can add contracts.

berndartmueller Follow

Originally disclosed on Code4rena

Submitted by berndartmueller

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;
        }
    }
}

Recommended mitigation steps

Add offset and limit function parameters to implement a “paginated” for loop.

toshiSat (Yieldy) acknowledged and commented:

Only the owner of the contract can add addresses to the contract.

JasoonS (judge) commented:

Hmm, would consider making this Low. But keeping it medium highlights the importance to be aware of this.


The original report as published on Code4rena, by berndartmueller. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The batch withdrawal function could become unusable if the list of contracts grows too large, but only the contract owner can add contracts, limiting the attack surface.

What the attacker needed

Owner adds many contracts

The fix

The function should be fixed by adding offset and limit parameters to process the list in smaller batches.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This contract has a function that tries to send withdrawal requests to every contract in a list, one by one. If the list gets very long, the function might use more gas than a block allows, so it always fails. That means the function becomes unusable, which is a denial of service.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by berndartmueller

View all

97 more disclosed reports, best first.

More from Yieldy contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.