DeFiHardhat
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Potential Unbounded Gas Consumption in External Call to beanstalkUpdate()

Summary

The code features a function, claimFertilized, that retrieves data related to fertilizers. However, if there are too many fertilizers, the function may run out of gas while attempting to return them all. To mitigate this risk, it's advisable to implement mechanisms such as allowing for a start offset and maximum length. This way, data can be returned in batches that don't exceed gas limits. The arises due to unbounded gas consumption in the external call to the beanstalkUpdate function, exacerbated by the use of an array both locally and in the external call.

Vulnerability Details

The claimFertilized function features an external call to the beanstalkUpdate function, passing an array (ids) as an argument. Additionally, the function itself iterates over the ids array locally. This dual usage of the array may lead to increased gas consumption, especially if the array size is unbounded or unexpectedly large.

Impact

  • High Gas Consumption: If the ids array is large, the gas cost of the claimFertilized function can become substantial. Each iteration over the array consumes gas, and if the array size is unbounded or unexpectedly large, it could lead to out-of-gas errors or prohibitively expensive transactions.

  • Potential Denial of Service (DoS): An attacker could potentially exploit this vulnerability by passing a large or infinite-sized array as the ids argument, causing excessive gas consumption and blocking other transactions from being processed due to high gas usage.

Tools Used

Manual code review was used to identify this potential vulnerability.

Recommendations

  • Limit Array Size: Implement measures to limit the size of the ids array passed to the claimFertilized function. This could include pagination, batch processing, or imposing a maximum array size to prevent excessive gas consumption.

Updates

Lead Judging Commences

giovannidisiena Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational/Invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.