Reproduced Exploit

Unbounded external loops can permanently DoS administration — gas-limit denial of service

An ever-growing assetsMapped array is traversed with external approvals. One paused/reverting token traps the whole operation; in production, array growth alone can exceed the gas limit.

Jan 2021Ethereumdos2 min read

Loss

Asset approval/liquidation administration becomes uncallable

Chain

Ethereum

Category

dos

Date

Jan 2021

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 18211-external-calls-in-loop-can-lead-to-denial-of-service-trailof. Standalone Foundry PoC and full write-up: 18211-external-calls-in-loop-can-lead-to-denial-of-service-trailof_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/dos/unbounded-loop · vuln/dependency/unsafe-external-call

Reproduction: self-contained synthetic Foundry reduction; see output.txt.

Key info#

FieldValue
LossAsset approval/liquidation administration becomes uncallable
Vulnerable contractAaveStrategy.safeApproveAllTokens
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractFailingAsset via Exploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2021-01
Compilersolc 0.8.24 (synthetic)
Bug classUnbounded loop over external token calls

TL;DR#

An ever-growing assetsMapped array is traversed with external approvals. One paused/reverting token traps the whole operation; in production, array growth alone can exceed the gas limit.

Background#

The Origin Dollar review identifies this pattern in AaveStrategy and several other contracts. The reduction models the first failing asset and captures the resulting denial of service.

The vulnerable code#

SOLIDITY
for (uint256 i; i < assetsMapped.length; ++i) {
    IApprover(assetsMapped[i]).approve(address(this), type(uint256).max);
}

Root cause#

There is no bounded iteration, removal path, or per-item failure handling for an externally controlled, unbounded list.

Preconditions#

  • The mapped asset list can grow over time.
  • At least one asset can revert or the loop can exceed the block gas limit.

Attack walkthrough#

  1. Exploit adds a healthy and a paused FailingAsset.
  2. safeApproveAllTokens reaches the paused token and reverts.
  3. The Proof event at output.txt:385 records the failed administrative call.

Diagrams#

flowchart TD A[Growing assetsMapped] --> B[Unbounded approval loop] B --> C{External token reverts} C --> D[Entire admin operation fails]

Remediation#

Process bounded slices, permit removal/compaction, and isolate per-asset failures. Avoid requiring one transaction to call every external token.

How to reproduce#

BASH
cd evm-hack-registry/18211-external-calls-in-loop-can-lead-to-denial-of-service-trailof_exp
forge test -vvvvv

Sources#

Reference: https://github.com/trailofbits/publications/blob/master/reviews/OriginDollar.pdf


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.