Reproduced Exploit
Valantis surplus is spent as the caller's swap payment
update wraps a native surplus and safeTransfers the wrapped token straight to the pool. A swap that sets isSwapCallback measures token.balanceOf(pool) after the callback and treats any increase as the caller's payment.
Loss
The caller receives 100 stHYPE. The 100 of token1 that pays for it comes from the module's surplus, not from…
Chain
Ethereum
Category
reentrancy
Date
Mar 2025
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: 56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy. Standalone Foundry PoC and full write-up: 56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/reentrancy/callback-payment · vuln/defi/surplus-theft
Key info#
| Field | Value |
|---|---|
| Loss | The caller receives 100 stHYPE. The 100 of token1 that pays for it comes from the module's surplus, not from the caller |
| Vulnerable contract | Pool.swap |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4 |
| Attack tx | Exploit.run() with value 100, forwarded to the module |
| Chain / block / date | Ethereum model · block 0 · 2025-03 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | update transfers surplus token1 into the pool during a swap callback, and the pool counts that balance increase as payment |
TL;DR#
update wraps a native surplus and safeTransfers the wrapped token straight to the pool. A swap that sets isSwapCallback measures token.balanceOf(pool) after the callback and treats any increase as the caller's payment.
The module holds 100. The pool holds 100 token0. The caller has no token1. During the callback, update moves the 100 into the pool. The pool records a payment of 100 and sends 100 token0 to the caller.
The fixed update reverts while pool.inSwap() is true, so the callback cannot spend the surplus. A swap with the callback flag off pulls 100 of the caller's own token1, and the module still holds its 100.
The vulnerable code#
uint256 got = token1.balanceOf(address(this)) - pre;
received = got; // @> VULN: token1 sent by update() during the callback counts as the caller's payment
require(got >= amountOut, "unpaid");
update is the quoted donor:
token1.deposit{value: surplus}();
token1.transfer(address(pool), surplus);
Impact#
The module's 100 surplus pays for the caller's swap. The caller holds 100 stHYPE and spent none of their own token1.
How to reproduce#
cd 56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy_exp
forge test -vv
test_exploit_surplus_pays_for_the_swap asserts the attacker holds 100 token0 and the module balance is 0. test_control_swap_cannot_spend_the_surplus asserts the callback reverts and a paid swap leaves the 100 surplus in the module.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy.md
- Hexens report: Valantis, 2025-03-17
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy_exp (evm-hack-registry mirror).
- AuditVault finding: 56683-vlts3-13-direct-theft-of-surplus-balance-when-unstaking-sthy.
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.