1/ π¨ DeepBook was drained of $239,700 on May 9 using just ~$2,500 in capitalβa massive 100x return.
No reentrancy, no oracle attack, no access control bypass. Just two order-placement paths with mismatched price validation.
pool::place_limit_order β no price check
pool_proxy::place_limit_order β price β [Pyth Β± tolerance]
Margin uses proxy. Regular accounts use raw. Same orderbook. Same attacker. π§΅
2/
Attacker uses TWO BalanceManagers, both their own:
β’ BM 0xe63374a58f2a63fe8554f0e9210332848654bd1130931c0719b1e9ba0a4fa30a (regular)
β’ MM 0xe63374a58f2a63fe8554f0e9210332848654bd1130931c0719b1e9ba0a4fa30a (margin β borrows USDC)
Per PTB, BM places a "trap" at the tolerance band edges:
SELL @ $1.0878 BUY @ $1.0759
(Pyth mid $1.0819, tolerance Β±0.55%)
1.1% spread, both legs pass proxy.
3/
But this only works if the band is empty of legitimate orders.
Phase A (asymmetric scan): attacker uses throwaway BMs as takers to sweep ~218K SUI / $235K of legitimate liquidity. Net cost: ~$1K in spread.
Now only BM's trap sits in the band.
4/
Phase B (wash loop): MM market-orders into BM's trap.
β’ MM BUY β only ASK in band = BM's $1.0878 β MM pays high
β’ MM SELL β only BID in band = BM's $1.0759 β MM gets low
Each round trip: $0.0119/SUI leaks MM's borrowed pool β BM.
Run 35Γ, 70 70 fills at exact band edges.
5/
After PTB: MM insolvent β $283K bad debt to suppliers. BM keeps ~$96K 8K SUI. Flashloan repaid same-PTB.
Just 4 successful attack txs over 50 mins. Bridged 78 ETH 0.7 BTC to a single EVM address.
6/ π‘οΈ The AstraSec Takeaway:Vulnerabilities don't always hide in complex mathβthey hide in architectural inconsistencies. When proxy logic and raw pool logic don't enforce the same invariants, attackers will bridge the gap.
At ~3:18 AM UTC today, an undercollateralization vulnerability accrued $239,700 in bad debt in the USDC margin pool. Margin Trading has been temporarily paused.
The Deepbook Insurance Fund has injected the amount of lost funds back into the affected pools. Deposits and withdrawals have now resumed.