Skip to content
DoS Audit finding Intermediate

Unbounded iteration over all indexes (2)

The smart contract iterates over an array of indexes without a bound, so if the array grows too large, transactions will consume more gas than the block limit and fail. This could cause a denial of service for core functionality.

Dravee Follow

Originally disclosed on Code4rena

Submitted by Dravee, also found by robee, egjlmn1, danb, WatchPug, Fitraldys, and Ruhum

The transactions could fail if the array get too big and the transaction would consume more gas than the block limit. This will then result in a denial of service for the desired functionality and break core functionality.

Proof of Concept

https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L703

Tools Used

VS Code

Recommended Mitigation Steps

Keep the array size small.

oishun1112 (Insure) confirmed

0xean (judge) commented:

Upgrading to sev-2 as this will eventually affect the availability of the protocol as transactions revert.

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

This could cause a denial of service for the affected functionality and break core protocol operations as transactions revert.

What the attacker needed

Array grows large enough

The fix

The array size should be kept small to prevent gas costs from exceeding the block 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 has a list of items and a function that goes through every item each time it is called. If the list becomes very long, the function uses too much gas (the fee for computation) and the transaction fails, so users cannot use that function.

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 Dravee

View all

9 more disclosed reports, best first.

More from InsureDAO 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.