What happened in the Cetus exploit?

On 22 May 2025, starting at about 10:30 UTC, an attacker took about $223M from Cetus, a decentralized exchange on Sui, by opening a huge liquidity position for about 1 unit of one token (The Block; BlockSec). The root cause was an overflow check in checked_shlw, a function in the open-source integer-mate math library, that compared against the wrong limit, so a left shift in the deposit math silently lost its top bits (Cyfrin). Sui validators froze about $162M of it before it left Sui (The Block). Cetus is written in Move, which QuillShield doesn't support today. For Move code, request a manual audit from QuillAudits.

Last updated . 6 minute read. By the QuillAudits Team.

What is the timeline of the Cetus exploit?

Protocol Cetus
Date 22 May 2025
Chain Sui
Loss about $223M (Cetus); about $260M (Cointelegraph)
What happened checked_shlw in the integer-mate library was meant to flag any value that would overflow when shifted left by 64 bits, but its bound was far too high. The attacker opened a position with an enormous liquidity value over a narrow price range, the shifted value lost its top bits, and the pool asked for about 1 unit of token A. Removing that liquidity paid out real tokens. Sui validators froze about $162M, which was later moved to a recovery multisig.
Sources The Block, BlockSec, Cyfrin
  1. 22 May 2025, 10:30:50 UTC: the attack starts (Cointelegraph). Elliptic also puts the start at about 10:30 UTC (Elliptic).
  2. 10:40 UTC: monitoring flags irregular activity in the pools (Cointelegraph).
  3. 10:53 UTC: Cetus finds the source of the attack and alerts the Sui ecosystem (Cointelegraph).
  4. 10:57:47 UTC: Cetus shuts its core CLMM pools (Cointelegraph), within 30 minutes of the start (The Block).
  5. 11:20 UTC: all related smart contracts are disabled (Cointelegraph).
  6. 12:50 UTC: Sui validators start voting to ignore transactions from the attacker's addresses. Once more than 33% of stake agrees, those addresses are effectively frozen (Cointelegraph).
  7. 18:04 UTC: an on-chain message opens negotiation with the attacker (Cointelegraph).
  8. 18:15 UTC: the vulnerable contract is patched but not yet reactivated (Cointelegraph).
  9. By 27 May 2025: Cetus proposes an on-chain vote to recover the frozen $162M, offers the attacker a white-hat settlement and announces a $5M bounty for information that leads to the attacker's identification and arrest (The Block).
  10. 29 May 2025: Sui validators approve moving the frozen $162M to a multisig controlled by Cetus, OtterSec and the Sui Foundation, with 90.9% voting yes (Cointelegraph; Cyfrin).

What was the overflow bug in checked_shlw?

Cetus runs concentrated liquidity (CLMM) pools: a liquidity provider picks a price range, and the pool works out how much of each token the position needs. Part of that math shifts a 256-bit value left by 64 bits with checked_shlw (Cyfrin), which is meant to report an overflow for any value that would not fit after the shift. A value fits only if it is below 2^192. The check compared against 0xffffffffffffffff << 192 instead (BlockSec), which Cetus's report describes as checking against a 256-bit limit where a 192-bit one was needed (The Block). Every value between the two passed, and the shift dropped its top bits.

Vulnerable: checked_shlw in Move, simplified, not the original code (illustrative, not audited code) math_u256.move

// Meant to return (n << 64, false), or (0, true) when the shift would overflow.
public fun checked_shlw(n: u256): (u256, bool) {
    let mask = 0xffffffffffffffff << 192;
    // Wrong bound: values from 2^192 up to this mask pass the check.
    if (n > mask) {
        (0, true)
    } else {
        // The shift drops the bits that no longer fit, with no error.
        ((n << 64), false)
    }
}

Fixed: the bound Cyfrin describes, n >= 1 << 192, simplified (illustrative, not audited code) math_u256_fixed.move

public fun checked_shlw(n: u256): (u256, bool) {
    // n << 64 fits in 256 bits only when n is below 2^192.
    if (n >= (1 << 192)) {
        (0, true)
    } else {
        ((n << 64), false)
    }
}

With that gap open, the attacker borrowed tokens with a flash swap and opened a position over a very narrow tick range, about 300000 to 300200, with a liquidity value of 10,365,647,984,364,446,732,462,244,378,333,008. The pool worked out the token A it needed as about 1 unit (BlockSec). The attacker then removed liquidity for real tokens, repaid the flash swap, kept the rest and repeated the steps across pools (Cyfrin). The flawed check sat in an open-source library that Cetus's contract used, not in the pool logic itself (The Block).

Can the same bug happen in Solidity?

Yes. Solidity 0.8 reverts when +, - or * overflows, but it never checks a shift: bits that fall off the top are dropped, as in Move. In our test with solc 0.8.28, (1 << 200) << 64 returns 0 without reverting. Any hand-written overflow guard around a shift, and any math in an unchecked block or in assembly, needs the same boundary test. Here is Cetus's check in Solidity, next to the correct one. The class is covered on integer overflow and underflow.

The same flawed check in Solidity, next to the correct one (illustrative, not audited code) ShiftMath.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

library ShiftMath {
    // Wrong: lets through values from 2**192 up to 2**256 - 2**192.
    function checkedShlwFlawed(uint256 n) internal pure returns (uint256, bool) {
        uint256 mask = uint256(0xffffffffffffffff) << 192;
        if (n > mask) return (0, true);
        return (n << 64, false); // Solidity does not check shifts: the top bits are dropped
    }

    // Right: n << 64 fits in 256 bits only when n < 2**192.
    function checkedShlw(uint256 n) internal pure returns (uint256, bool) {
        if (n >= 1 << 192) return (0, true);
        return (n << 64, false);
    }
}

How much did Cetus lose?

About $223M by Cetus's count, as reported by The Block (The Block), and BlockSec and Cyfrin use the same figure (BlockSec; Cyfrin). Cointelegraph puts it at about $260M (Cointelegraph). Elliptic, which counts over $200M, explains the gap: some reports valued the tokens before the theft at more than $260M, but several of the stolen tokens fell in value afterwards (Elliptic).

About $162M stayed on Sui and was frozen. Roughly $60M had already been swapped to USDC, bridged to Ethereum and swapped for ETH (The Block).

How were the frozen funds recovered?

Sui validators ignored transactions from the attacker's addresses once more than 33% of stake had voted to, which kept about $162M on Sui (Cointelegraph; The Block). Cetus then asked validators to vote on moving those funds. On 29 May 2025 they approved it, 90.9% in favor, and the funds went to a multisig controlled by Cetus, OtterSec and the Sui Foundation (Cointelegraph). Cyfrin reports that full recovery was backed by Cetus's treasury and by a Sui Foundation loan that covered the part that had already left Sui (Cyfrin).

A freeze like this depends on a chain's validators acting together. It is not something a contract can plan on.

What would a proof-of-concept-first audit test here?

Test the boundary, not the happy path. For a checked shift the property is short: when the function reports no overflow, shifting the result back must give the input again. A fuzzer finds a counterexample fast, because almost every 256-bit value is above 2^192, and a unit test pins the first value that does not fit.

Boundary tests for a checked left shift, aimed at the flawed bound (illustrative, not audited code) CheckedShlwTest.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// Foundry-style tests. Both fail against the flawed bound and pass with n >= 1 << 192.
contract CheckedShlwTest {
    function checkedShlw(uint256 n) public pure returns (uint256, bool) {
        uint256 mask = uint256(0xffffffffffffffff) << 192; // the bound under test
        if (n > mask) return (0, true);
        return (n << 64, false);
    }

    // Property: if no overflow is reported, no bits were lost.
    function testFuzz_noSilentTruncation(uint256 n) public pure {
        (uint256 shifted, bool overflow) = checkedShlw(n);
        if (!overflow) require(shifted >> 64 == n, "bits were lost without an overflow flag");
    }

    // The first value that does not fit after the shift.
    function test_firstValueThatDoesNotFit() public pure {
        (, bool overflow) = checkedShlw(1 << 192);
        require(overflow, "2**192 shifted left by 64 does not fit in 256 bits");
    }
}

We ran both tests with Foundry and solc 0.8.28: against the flawed bound both fail, and with n >= 1 << 192 both pass.

  • Find every hand-written overflow check, every shift and every unchecked block, and fuzz each one at its boundary.
  • Write the invariant the attack broke: with prices held fixed, removing a position never pays out more than it took to open it.
  • Treat the libraries in scope like your own code. Here the flawed check sat in a shared math library.

QuillShield supports Solidity in Foundry projects today, not Move. On a Solidity codebase, a full audit reviews the arithmetic across the code in scope, a separate reviewer agent tries to disprove each finding, and on full audits each finding that holds up comes with a proof of concept. For Move code like Cetus's, request a manual audit from QuillAudits or talk to an auditor. Before any audit, the audit readiness checklist helps you list the boundaries worth testing.

FAQ

Does QuillShield audit Move code?

No. QuillShield supports Solidity in Foundry projects today. For Move, including code on Sui, request a manual audit from QuillAudits. The Move page covers the language's bug classes.

Was the bug in Cetus's own code?

It was in checked_shlw, part of integer-mate, an open-source math library that Cetus's contract used (The Block; BlockSec). Cetus patched the vulnerable contract the same day (Cointelegraph).

Did Sui freeze the stolen funds?

Most of them. Validators ignored transactions from the attacker's addresses, which froze about $162M on Sui. About $60M had already been bridged to Ethereum (The Block).

Sources

QuillShield is building the security layer between AI and money, so you can keep shipping between audits.

Sign-up is free, and new accounts get $50 in credit, good for up to half of an order.

  1. 1Sign up and import a repo
  2. 2See the exact price before anything is charged
  3. 3Approve it, and the audit starts