Reproduced Exploit
Rubicon — RubiconMarket checks slippage incorrectly
sellAllAmount requires fill_amt >= min_fill_amount before calcAmountAfterFee, so a post-fee floor can be violated.
Chain
Other
Category
untagged
Date
Apr 2023
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. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub. Standalone Foundry PoC and full write-up: 48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub_exp in the
evm-hack-registrymirror.
Vulnerability classes: fee-calculation · fot-slippage · direct-drain
Reproduction: self-contained Foundry PoC with only
forge-std— no fork, no RPC. Full trace: output.txt. PoC: test/48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub_exp.sol.
Key info#
| Impact | HIGH — User receives less than min_fill_amount after fees because slip check is pre-fee |
| Protocol | Rubicon |
| Bug class | fee-calculation · fot-slippage · direct-drain |
| Finding | Code4rena 2023-04-rubicon · #48950 · H-11 · reporter zhuXKET |
| Report | code4rena.com/reports/2023-04-rubicon |
| Source | AuditVault |
| Status | Confirmed. Reproduced as a standalone local synthetic. |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
sellAllAmount requires fill_amt >= min_fill_amount before calcAmountAfterFee, so a post-fee floor can be violated.
The vulnerable code#
See synthetic test/48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub.sol (@> VULN markers).
Fix: Apply calcAmountAfterFee before the min_fill_amount require.
Root cause#
sellAllAmount requires fill_amt >= min_fill_amount before calcAmountAfterFee, so a post-fee floor can be violated.
Preconditions#
Protocol deployed with the vulnerable code paths from the Code4rena contest.
Attack walkthrough#
See PoC run() and output.txt.
Diagrams#
Impact#
User receives less than min_fill_amount after fees because slip check is pre-fee
Taxonomy#
genome: fee-calculation · fot-slippage · direct-drainseverity/high·platform/code4rena
Sources#
- AuditVault finding #48950
- Code4rena report 2023-04-rubicon
- Repo@commit: code-423n4/2023-04-rubicon · contracts/RubiconMarket.sol sellAllAmount ~L1028-L1067
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub_exp (evm-hack-registry mirror).
- AuditVault finding: 48950-h-11-rubiconmarket-checks-slippage-incorrectly-code4rena-rub.
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.