Toutes les vulnérabilités
CRITICALWeb3exploited in the wild

WEB3-VELOCORE-2024

Web3 · Linea · Velocore

Résumé

On June 2, 2024, the DEX Velocore was drained of about $6.8 million from its constant-product (volatile) pools on Linea and zkSync Era. The root cause combined a missing access-control modifier with an unchecked arithmetic underflow in the ConstantProductPool fee math: velocore__execute performed Vault-only state changes but had no onlyVault check, so anyone could call it directly. The pool's feeMultiplier, which increases per withdrawal and resets each block to deter free swaps, fed an effective fee computed as fee1e9 * feeMultiplier / 1e9 with no upper bound and inside an unchecked block. By repeatedly invoking velocore__execute to inflate feeMultiplier, the attacker drove effectiveFee1e9 above 100% (> 1e9), so the growth term 1e18 - ((1e18 - k) * effectiveFee1e9) / 1e9 underflowed and wrapped to a huge unsigned value, causing a small single-token withdrawal to be accounted as a massive deposit and mint excessive LP tokens. Linea controversially paused its sequencer for about an hour to stop the remaining funds from bridging out.

Comment l’éviter dans votre code

  • Restrict pool callbacks like velocore__execute with an onlyVault modifier verifying the trusted caller.
  • Bound fee multipliers and reject any effective fee exceeding 100% before it enters pool math.
  • Avoid unchecked blocks on subtractions that can go negative; let Solidity 0.8 revert on underflow.
  • Add invariant checks that LP minted matches value deposited, reverting on accounting divergence.
  • Fuzz/invariant-test AMM math at boundary inputs such as 100% withdrawals and max fee states.

Références

Vulnérabilités liées

Tout Web3 →