All vulnerabilities
CRITICALWeb3exploited in the wildcurated

WEB3-CETUS-SUI-2025

Web3 · Sui · Cetus Protocol (integer-mate)

Summary

On 22 May 2025, Cetus Protocol, the largest decentralized exchange on the Sui blockchain, was drained of about $223 million in the time it takes to read this sentence. The attacker did not steal a key or trick a signer. They found a single wrong constant in an overflow check, buried not in Cetus's own code but in a shared open-source math library, integer-mate, that Cetus and several other Sui projects all depended on. With a one-token deposit and a flash loan, they convinced the protocol that a position worth almost nothing was worth a fortune, then withdrew the real reserves. It is the cleanest modern example of a vulnerability in a dependency draining the protocols built on top of it, and the second largest crypto theft of 2025 after Bybit.

How it happened

Cetus is a concentrated-liquidity decentralized exchange: users supply tokens to pools within chosen price ranges, and the contract math decides how much liquidity a deposit is worth. The vulnerable code was a function called checked_shlw in the integer-mate library, meant to reject a left-shift that would overflow a 256-bit integer. To be safe it had to reject any number with bits set above the 192nd, that is, any value of 2^192 or greater. Instead it compared against the wrong bound, a mask of 0xffffffffffffffff << 192, which is an enormous number, so almost every value that would actually overflow sailed through as "safe." Move, the language Sui contracts are written in, silently truncates on a shift overflow rather than aborting, so the inflated number simply wrapped around to a tiny one. It was a textbook integer overflow, hiding behind a check that was supposed to prevent exactly that.

The attacker turned the wrap into money. Using a flash loan they crashed a pool's price, opened a liquidity position in an extremely narrow price range, and chose a liquidity amount large enough to trip the broken check in the function that computes how many tokens a position requires. The overflow made that calculation round all the way down to a single token. So they deposited one token, were credited an astronomically large position, and withdrew the pool's real reserves, roughly 10 million haSUI, 5.7 million SUI, and more. They repeated it across pools. In minutes, about $223 million was gone.

The shared-library blast radius

The detail that makes Cetus matter is where the bug lived. integer-mate is not Cetus's own code; it is a shared, open-source Move math library that multiple Sui protocols import for their pricing math. The flaw was in the library, not in how Cetus called it, so every project that trusted that overflow check inherited the same hole. Forensic teams found related exposure in other Sui DeFi protocols including Kriya, Momentum, and Bluefin, which patched once the library was fixed (the correct bound is 1 << 192). Cetus had passed multiple audits; none of them caught one wrong constant in a dependency. It is the same class of failure as Curve's Vyper compiler bug, where developers wrote correct code on top of a broken tool. This is a supply-chain attack in the truest sense: the compromised artifact was a library everyone trusted.

The aftermath

Of the roughly $223 million, about $162 million never left Sui. The validators running the network coordinated to ignore the attacker's transactions, freezing those funds in place. That worked, and it was controversial: a network whose validators can socially agree to censor an address is, by definition, not as trustless as advertised, and critics said so loudly. The remaining roughly $60 million had already been bridged to Ethereum and converted to ether, beyond reach. Cetus offered the attacker a time-limited white-hat deal, keep about $6 million and return the rest with no legal action, which went unanswered, plus a separate $5 million bounty for information identifying them. A protocol-wide governance vote then passed with about 91 percent of staked SUI in favour, moving the frozen funds to a recovery multisig. Backed by that, its own treasury, and a $30 million loan from the Sui Foundation, Cetus refilled its pools and relaunched, making users substantially whole. No attacker was ever publicly identified.

Why Cetus still matters

Cetus is the lesson that your dependencies are your attack surface. The protocol's own logic was sound; one incorrect comparison in a library it imported was enough to drain it, and to threaten every other project importing the same library. The defences are the unglamorous ones: pin and audit the exact versions of every dependency, not just your own code; treat third-party math and utility libraries as security-critical and fuzz them at their boundaries, since overflow checks are a classic place for off-by-a-power-of-two mistakes; add independent invariant checks so an impossible position value is rejected even when a library lets it through; and bound withdrawals so a single transaction cannot empty a pool. The bug was never in the app. It was in what the app trusted.

How to fix it

  • Patch the integer-mate library to the corrected overflow check (the `1 << 192` bound) and redeploy every contract built against the vulnerable version.
  • Pause affected pools, then trace and flag the stolen funds fast; Sui's validator freeze preserved the majority precisely because the response was immediate.
  • Add invariant and bounds checks that reject impossible liquidity or token amounts even when a library miscalculates.

How to avoid it

  • Pin and audit the exact versions of every third-party library, and re-audit when a dependency ships a security fix.
  • Treat shared math and utility libraries as security-critical: fuzz their overflow and boundary behaviour, since one wrong constant can drain everyone who imports them.
  • Add independent invariant checks (sane bounds on amounts, liquidity, and prices) so a single bad calculation cannot authorise a drain.
  • Cap or rate-limit withdrawals relative to deposits so no single transaction can empty a pool.
  • Prefer audited, widely reviewed libraries, and verify deployed bytecode against the reviewed source.

References

Related vulnerabilities

All Web3 →