All vulnerabilities
CRITICALWeb3exploited in the wild

WEB3-BUNNI-2025

Web3 · Ethereum · Bunni v2 (Uniswap v4 liquidity manager)

Summary

On September 2, 2025 Bunni, a liquidity manager built on Uniswap v4, was drained of roughly $8.4 million across Ethereum and Unichain (USDC, USDT, and weETH/ETH) through a rounding error in its withdrawal accounting amplified by flash loans. Bunni's Liquidity Distribution Function (LDF) tracks an 'idle balance' that is rebalanced on every swap, and the withdraw path rounded that balance in the wrong direction under specific conditions. The attacker flash-borrowed millions in USDT and executed a precisely sized sequence of swaps that pushed the pool's spot price back and forth across tick boundaries, triggering the faulty rounding repeatedly; each cycle let them withdraw more tokens than they burned in liquidity (in the USDC/USDT pool the idle balance fell 85.7% while liquidity fell only 84.4%, and that gap was the leak). The bug was application-specific accounting math, not an oracle or price-feed flaw. Unable to fund a secure relaunch, the Bunni team announced on October 23, 2025 that it was permanently shutting down, leaving withdrawals open and relicensing v2 from BUSL to MIT.

How to avoid it in your code

  • Round every share and balance calculation in the protocol's favour and reject withdrawals that return more value than the liquidity actually burned.
  • Invariant- and fuzz-test accounting math (Foundry/Echidna) at tick boundaries and extreme swap sizes, not just typical inputs.
  • Assume any single-transaction state can be funded by a flash loan; test every accounting path under flash-loan-sized inputs.
  • Add per-transaction sanity checks and circuit breakers that halt on anomalous divergence between idle balance and liquidity burned.
  • Independently re-audit custom AMM/distribution math; off-the-shelf guards do not cover protocol-specific curve functions.

References

Related vulnerabilities

All Web3 →