Reproduced Exploit

Cork — Attacker can perform MEV by providing amountOutMin = 0 for ERC-2612 permit swaps

1. User signs an EIP-2612 permit so the router can pull RA without a prior approve tx. 2. Any third party can submit that permit to swapRaforDs(..., amountOutMin, user, sig, ...). 3. Attacker sets amountOutMin = 0, frontruns by dumping into the AMM, then lands the victim swap at a ruined rate. 4. V…

Dec 2024Otheruntagged2 min read

Chain

Other

Category

untagged

Date

Dec 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

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.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 53124-attacker-can-perform-mev-by-providing-amountoutmin-0-for-all. Standalone Foundry PoC and full write-up: 53124-attacker-can-perform-mev-by-providing-amountoutmin-0-for-all_exp in the evm-hack-registry mirror.


Vulnerability classes: impact/mev/frontrun · spot-price · frontrun-exposure

Reproduction: self-contained Foundry PoC with only forge-std — no fork. output.txt · test/53124-…_exp.sol.

AuditVault taxonomy: lang/solidity · sector/dex · platform/cantina · severity/high · impact/mev/frontrun · genome: spot-price · frontrun · frontrun-exposure


Key info#

ImpactHIGH — anyone holding a valid user permit can submit the swap with amountOutMin = 0, disable slippage protection, and sandwich the victim
ProtocolCork Protocol — FlashSwapRouter permit-based RA↔DS swaps
Vulnerable codeswapRaforDs / swapDsforRa accept caller-chosen amountOutMin after consuming the user's permit
Bug classSlippage parameter not bound into the permit signature; third-party submission
FindingCantina — Cork, December 2024 · #53124 · reporter 0xDjango
Reportcantina_competition_cork_december2024.pdf
SourceAuditVault
FixCork PR 280 — do not allow free amountOutMin on permit-initiated swaps
Compiler^0.8.24 (PoC)

TL;DR#

  1. User signs an EIP-2612 permit so the router can pull RA without a prior approve tx.
  2. Any third party can submit that permit to swapRaforDs(..., amountOutMin, user, sig, ...).
  3. Attacker sets amountOutMin = 0, frontruns by dumping into the AMM, then lands the victim swap at a ruined rate.
  4. Victim loses full input RA and receives far less DS than a fair quote; attacker extracts from the dump leg.

Diagrams#

sequenceDiagram participant V as Victim participant A as Attacker participant R as FlashSwapRouter participant P as AMM V->>V: Sign permit for router A->>P: Frontrun dump RA A->>R: swapRaforDs amountOutMin=0 + permit R->>R: permit pulls victim RA R->>P: swap with minOut 0 P-->>R: low DS out R-->>V: victim gets crushed quote

Impact#

Material value extraction from any user who issues a permit for the flash-swap router without binding a minimum output into the signed payload.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

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.