Reproduced Exploit
Notional values an unfinalized withdrawal split at the whole withdrawal
_calculateValueOfWithdrawRequest is supposed to scale a split by vaultShares / totalShares once the split is finalized. The quoted branch returns the full withdrawal value when finalized is still false.
Loss
A 40-share piece of a 100-share withdrawal is valued at 100, which is 60 too high
Chain
Ethereum
Category
logic
Date
Jun 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd. Standalone Foundry PoC and full write-up: 35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/logic/withdraw-valuation · vuln/defi/collateral-overvalue
Key info#
| Field | Value |
|---|---|
| Loss | A 40-share piece of a 100-share withdrawal is valued at 100, which is 60 too high |
| Vulnerable contract | Vault.valueOf |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4 |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-06 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | An unfinalized split falls through to the full withdrawal value |
TL;DR#
_calculateValueOfWithdrawRequest is supposed to scale a split by vaultShares / totalShares once the split is finalized. The quoted branch returns the full withdrawal value when finalized is still false.
The withdrawal is worth 100. This piece is 40 shares of 100. valueOf stores 100. The control returns 100 * 40 / 100, which is 40. The overstatement is 60.
The vulnerable code#
if (w.hasSplit) {
SplitWithdrawRequest memory s = splits[w.requestId];
if (s.finalized) {
return fullValue[w.requestId] * w.vaultShares / s.totalShares;
}
}
borrowTokenValue = _getValueOfWithdrawRequest(w); // @> VULN: the unfinalized 40-share piece is valued as the whole 100
Impact#
Collateral and borrow checks that read this value treat a 40-share piece as the entire 100. The account is overvalued by 60.
How to reproduce#
cd 35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd_exp
forge test -vv
test_exploit_unfinalized_split_is_valued_at_100 asserts the stored value is 100. test_control_scales_the_piece_to_40 asserts the scaled value is 40.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd.md
- Sherlock contest: leveraged-vaults, 2024-06
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd_exp (evm-hack-registry mirror).
- AuditVault finding: 35125-h-12-the-withdrawvalue-calculation-in-calculatevalueofwithd.
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.