Reproduced Exploit
VirtualToken cashIn mints msg.value and locks the ERC20 deposit
cashIn pulls amount of the underlying token, then mints msg.value. For an ERC20 that value is 0. A call with 100 USDT and no ETH leaves the virtual token holding 100 and the depositor holding 0 shares.
Loss
100 USDT is pulled into the virtual token and the depositor is minted 0 shares
Chain
Ethereum
Category
logic
Date
Dec 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: 49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due. Standalone Foundry PoC and full write-up: 49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/logic/mint-amount · vuln/defi/deposit
Key info#
| Field | Value |
|---|---|
| Loss | 100 USDT is pulled into the virtual token and the depositor is minted 0 shares |
| Vulnerable contract | VirtualToken.cashIn |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4 |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-12 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | An ERC20 cash-in mints msg.value instead of amount |
TL;DR#
cashIn pulls amount of the underlying token, then mints msg.value. For an ERC20 that value is 0. A call with 100 USDT and no ETH leaves the virtual token holding 100 and the depositor holding 0 shares.
The fixed cashIn mints amount. The same 100 USDT deposit credits 100 shares.
The vulnerable code#
function cashIn(uint256 amount) external payable {
asset.transferFrom(msg.sender, address(this), amount);
lastValue = msg.value;
_mint(msg.sender, msg.value); // @> VULN: ERC20 cash-in mints msg.value, which is 0
}
Impact#
The depositor pays 100 USDT and receives nothing back. The 100 sits in the virtual token.
How to reproduce#
cd 49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due_exp
forge test -vv
test_exploit_erc20_mints_zero asserts 0 shares and 100 USDT inside the token. test_control_mints_the_amount asserts 100 shares.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due.md
- Code4rena report: 2024-12-lambowin
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due_exp (evm-hack-registry mirror).
- AuditVault finding: 49608-h-01-loss-of-user-funds-in-virtualtokens-cashin-function-due.
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.