Reproduced Exploit

The last vault claim pays the request plus the idle balance

claim treats the last withdrawal differently. When there is no shortfall it adds idleAssets() to the requested amount and transfers that sum. Idle assets are the balance that should stay for the next deposit.

Nov 2024•Ethereum•logic•2 min read

Loss

A request of 100 is paid 150. The extra 50 is the vault's idle balance

Chain

Ethereum

Category

logic

Date

Nov 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack replays in your browser. Step through it by Solidity line or by opcode.

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. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 62399-loglab-15-last-withdrawer-could-give-next-depositor-0-shares. Standalone Foundry PoC and full write-up: 62399-loglab-15-last-withdrawer-could-give-next-depositor-0-shares_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/last-withdraw · vuln/defi/overpayment

Key info#

FieldValue
LossA request of 100 is paid 150. The extra 50 is the vault's idle balance
Vulnerable contractVault.claim
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-11
Compilersolc 0.8.27, cancun, via IR
Bug classThe last claim sets executedAssets to requestedAssets + idleAssets
flowchart TD A["The vault holds 150. The request is 100 and idle is 50"] --> B["This claim is the last one"] B --> C["VULN executed assets become 100 plus 50"] C --> D["The caller receives 150"] B --> E["Control pays the requested 100"] E --> F["50 stays in the vault"]

TL;DR#

claim treats the last withdrawal differently. When there is no shortfall it adds idleAssets() to the requested amount and transfers that sum. Idle assets are the balance that should stay for the next deposit.

The vault holds 150. The request is 100 and idle is 50. The last claim pays 150. The control pays 100 and leaves 50 in the vault.

The vulnerable code#

SOLIDITY
uint256 idleAssets = idle;
assetsToClaim += idleAssets;
executedAssets = requested + idleAssets; // @> VULN: the last claim pays the request plus every idle asset

Impact#

The last withdrawer takes the idle balance on top of their request. Here that is 50 extra, and the vault is emptied.

How to reproduce#

BASH
cd 62399-loglab-15-last-withdrawer-could-give-next-depositor-0-shares_exp
forge test -vv

test_exploit_last_claim_pays_idle asserts the caller receives 150. test_control_pays_the_request_only asserts a payment of 100 and 50 left in the vault.

Sources#


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.