Reproduced Exploit
Regnum Aurum: LiquidationSwap's slippage floor is the already-sandwiched spot
_swap reads liquidityPool.get_dy and sets minDy to that quote times (10000 - slippageProtectionBps) / 10000. The quote is the spot at execution time. A searcher sells index tokens first, so the spot the liquidation sees is already the bad price. With a 1% bps setting the check still passes. A 1000…
Loss
Stability pool receives 250 crvUSD instead of 500. Attacker nets 600 index tokens
Chain
Other
Category
defi
Date
Jun 2025
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. 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: 66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot. Standalone Foundry PoC and full write-up: 66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/defi/sandwich-attack
Key info#
| Field | Value |
|---|---|
| Loss | Stability pool receives 250 crvUSD instead of 500. Attacker nets 600 index tokens |
| Vulnerable contract | LiquidationSwap._swap |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Local synthetic · 2025-06 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | min-out is a haircut of get_dy inside the same transaction |
TL;DR#
_swap reads liquidityPool.get_dy and sets minDy to that quote times (10000 - slippageProtectionBps) / 10000. The quote is the spot at execution time. A searcher sells index tokens first, so the spot the liquidation sees is already the bad price. With a 1% bps setting the check still passes. A 1000 index sale that was worth 500 crvUSD returns 250. The searcher buys the index back and finishes 600 index tokens ahead. The same sale with a floor taken from the pre-trade 500 reverts and the index stays unsold.
The vulnerable code#
uint256 expectedDy = liquidityPool.get_dy(1, 0, amount);
if (expectedDy == 0) revert InvalidExchange();
uint256 minDy = enableSlippageProtection ? (expectedDy * (10000 - slippageProtectionBps)) / 10000 : 0; // @> VULN
liquidityPool.exchange(1, 0, amount, minDy);
Root cause#
Slippage protection compares the swap to itself. get_dy and exchange see the same manipulated reserves, so a haircut of the spot cannot detect a sandwich that already landed.
Preconditions#
- Slippage protection is on. Here
slippageProtectionBpsis 100. - The pool is a constant-product index/crvUSD pool the liquidation sells into. Reserves start at 2000 index and 1500 crvUSD.
- The liquidation sells a large clip. This run sells 1000 index, the whole seized balance.
Attack walkthrough#
- Fair
get_dy(1, 0, 1000)on the opening reserves is 500 crvUSD. - The attacker sells 1000 index and receives 500 crvUSD. Reserves become 3000 index and 1000 crvUSD.
liquidatecalls_swap.get_dyis now 250.minDyis 247.5. The swap returns 250 and passes the check.- The attacker sells the 500 crvUSD back and receives 1600 index. They started the call with 1000 index, so the profit is 600 index tokens.
- The stability pool is short 250 crvUSD versus the fair quote.
Diagrams#
Impact#
The stability pool is the loser on the liquidation swap. In this constant-product example it receives half of the pre-trade output, and the searcher extracts 600 index tokens. The report's concern is the same shape on a large RAAC-NFT liquidation, where swapPercentage is typically most of the seized index balance.
How to reproduce#
cd 66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot.md
- Report: https://github.com/pashov/audits/blob/master/team/md/RegnumAurum-security-review_2025-06-26.md
- Blamed lines:
LiquidationSwap._swapget_dyhaircut andexchange(..., minDy), as quoted in that review
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot_exp (evm-hack-registry mirror).
- AuditVault finding: 66505-h-04-liquidationswap-at-risk-of-sandwich-attacks-due-to-spot.
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.