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.
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
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.
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-registrymirror.
Vulnerability classes: vuln/dos/unbounded-loop · vuln/dependency/unsafe-external-call
Reproduction: self-contained synthetic Foundry reduction; see output.txt.
Key info#
| Field | Value |
|---|---|
| Loss | Asset approval/liquidation administration becomes uncallable |
| Vulnerable contract | AaveStrategy.safeApproveAllTokens |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | FailingAsset via Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2021-01 |
| Compiler | solc 0.8.24 (synthetic) |
| Bug class | Unbounded 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#
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#
Exploitadds a healthy and a pausedFailingAsset.safeApproveAllTokensreaches the paused token and reverts.- The
Proofevent at output.txt:385 records the failed administrative call.
Diagrams#
Remediation#
Process bounded slices, permit removal/compaction, and isolate per-asset failures. Avoid requiring one transaction to call every external token.
How to reproduce#
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
- Standalone PoC + full trace: 18211-external-calls-in-loop-can-lead-to-denial-of-service-trailof_exp (evm-hack-registry mirror).
- AuditVault finding: 18211-external-calls-in-loop-can-lead-to-denial-of-service-trailof.
Alerts & third-party analyses
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.