Skip to content
DoS Audit finding Intermediate

massUpdatePools() is susceptible to DoS with block gas limit

The massUpdatePools() function loops over all pools without a bound, so if the number of pools grows large enough, the transaction can exceed the block gas limit and fail. This could prevent the pools from being updated, potentially causing accounting errors and loss of earned rewards.

catchup Follow

Originally disclosed on Code4rena

Submitted by catchup

ConvexMasterChef.sol#L178-L183

massUpdatePools() is a public function and it calls the updatePool() function for the length of poolInfo. Hence, it is an unbounded loop, depending on the length of poolInfo. If poolInfo.length is big enough, block gas limit may be hit.

Proof of Concept

https://consensys.github.io/smart-contract-best-practices/attacks/denial-of-service/#dos-with-block-gas-limit

Recommended Mitigation Steps

I suggest to limit the max number of loop iterations to prevent hitting block gas limit.

0xMaharishi (Aura Finance) disagreed with severity and commented:

Duplicate of #147

LSDan (judge) commented:

This is not a duplicate of Duplicate of #147 and is also clearly documented as a potential issue in the code itself. If the admin were to accidentally add too many pools the contract would be affected, but the likelihood of this is low and if it were to happen, the admin could still turn off the pools and migrate to another contract. This would, however, affect the protocol in a severely negative way. Not fully updating all of the pools would potentially cause accounting issue and lead to loss of earned rewards. Given the impact and likelihood together, I think medium is actually reasonable in this case.

IllIllI000 (warden) commented:

@LSDan- The massUpdatePool() function was found to be non-critical in previous contests (https://github.com/code-423n4/2022-02-concur-findings/issues/161) and when I filed the issue with Convex for their bug bounty, they rejected it saying it was a “non-issue” and didn’t meet their criteria for a bounty. Furthermore, ConvexMasterChef.sol is not listed as in scope for this contest: https://github.com/code-423n4/2022-05-aura#contracts-of-interest

dmitriia (warden) commented:

@IllIllI000- Actually the scope was all non-test contracts, https://github.com/code-423n4/2022-05-aura#repo

LSDan (judge) commented:

@IllIllI000- Unlike the other contest, massUpdatePools() is used in this contract. I’m going to keep this as medium.

0xMaharishi (Aura Finance) confirmed and resolved


The original report as published on Code4rena, by catchup. 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

Root cause

Likely the function iterates over an unbounded array (poolInfo) without limiting the number of iterations, so the gas cost can exceed the block gas limit.

Impact

If the admin accidentally adds too many pools, the contract could be affected, potentially causing accounting issues and loss of earned rewards, though the likelihood is low and the admin could still turn off pools and migrate.

What the attacker needed

Admin adds too many pools

The fix

The function should be fixed by limiting the maximum number of loop iterations to prevent hitting the block gas limit.

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.

A smart contract function that updates all pools at once uses a loop that runs once per pool. If there are too many pools, the loop takes more gas than a single block allows, so the transaction always fails. This means the pools cannot be updated, which could mess up reward accounting.

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 catchup

View all

1 more disclosed report, best first.

More from Aura Finance 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.