Back to Blog

#1 Cetus Incident: One Unchecked Shift Drains $223M in the Largest DeFi Hack of 2025

Code AuditingPhalcon Security
February 9, 2026
6 min read
Key Insights

On May 22, 2025, Cetus Protocol, the largest concentrated-liquidity DEX on Sui, suffered a catastrophic exploit that drained liquidity across multiple pools, resulting in an estimated ~$223 million in losses. This incident stands as the largest DeFi hack of 2025, highlighting critical vulnerabilities in smart contract security, particularly concerning fixed-point arithmetic.

The exploit originated from a flaw in a custom overflow-prevention function, checked_shlw(). Due to an incorrect constant and comparison, this function failed to detect unsafe conditions before performing a left shift used in fixed-point u256 math. This oversight enabled a silent truncation of the most significant bits during crucial delta calculations, such as determining the token input required for a given liquidity. By carefully manipulating parameters like liquidity size and tick/price-range settings, the attacker could trick the protocol into computing a required deposit of essentially 1 unit of token, while simultaneously crediting their position with an enormous amount of liquidity. With this inflated position recorded on-chain, the attacker then removed liquidity and withdrew real reserves, effectively draining the pools.

Understanding Concentrated Liquidity and Fixed-Point Math

Cetus Protocol utilizes a concentrated liquidity market maker (CLMM) design, a sophisticated approach where liquidity providers (LPs) supply assets only within a chosen price range (a tick interval). Unlike traditional AMMs that distribute liquidity uniformly, CLMMs allow LPs to concentrate capital between specific lower and upper bounds. This design significantly improves capital efficiency but introduces a heavy reliance on precise fixed-point math for converting between:

  • The liquidity amount credited to a position.
  • The actual token amounts that must be deposited or can be withdrawn.

When a user adds liquidity, the protocol calculates the token deltas (how much underlying tokens are required) based on the current price and the selected range. Conversely, when liquidity is removed, the inverse calculation determines the amount of assets the position is entitled to withdraw.

The core vulnerability in the Cetus Incident exploited this intricate relationship: if the "how much you must deposit" calculation could be manipulated to be too small, while the position was still credited with large liquidity, an attacker could later remove that credited liquidity to withdraw real reserves from the pool. This highlights a common attack vector in DeFi protocols involving complex mathematical operations.

The Critical u256 Shift Vulnerability

The root cause of this massive DeFi hack was a bug within a helper function designed to safely perform a left-shift, a common operation in fixed-point u256 arithmetic (typically << 64 to apply a 2^64 scaling factor). In Move-based systems like Sui, overflow checks are not uniformly enforced across all operations, making manual safeguards for bit shifting crucial.

Cetus implemented an overflow-prevention helper, checked_shlw(), to verify whether shifting a u256 value left by 64 bits would exceed the 256-bit boundary. However, due to an incorrect constant and comparison, this critical check could be bypassed for certain large inputs that should have been rejected.

Specifically, the get_delta_a function, responsible for computing the amount of underlying tokens (Token A) required for liquidity provision between two prices (sqrt_price_0 and sqrt_price_1), calls checked_shlw(). The purpose of checked_shlw() here is to ensure the numerator in the Token A calculation does not overflow when shifted.

The flaw lay in checked_shlw()'s overflow check, which used a mask of 0xffffffffffffffff << 192 (equivalent to 2^256 - 2^192). This mask is significantly larger than the correct threshold. Consequently, an input value greater than 2^192 but smaller than this erroneous mask could pass the check, even though shifting it left would indeed exceed the u256 range. The subsequent left shift then resulted in a silent truncation, producing an incorrect and significantly smaller value.

The figure below illustrates the difference between the vulnerable implementation and the patched version. The correct boundary should have been 1 << 192, not the much larger 0xffffffffffffffff << 192. The attacker ingeniously exploited this flawed check to mint an unusually large amount of LP tokens while depositing a minimal amount, such as 1 wei of Token A.

Comparison of vulnerable and patched u256 shift implementation in Cetus
Comparison of vulnerable and patched u256 shift implementation in Cetus

Anatomy of the Cetus DeFi Hack

While the attacker applied the same technique across multiple pools, the underlying attack flow remained consistent. Let's analyze a specific transaction to understand the steps involved in this sophisticated blockchain security breach.

1. Manipulate the Pool Price with a Flashloan

The attack began with the attacker utilizing a flashloan to rapidly acquire 10,024,321.28 haSUI. They then swapped out 5,765,124.79 SUI, intentionally driving the pool price down from 18,956,530,795,606,879,104 to 18,425,720,184,762,886. This strategic price movement was crucial, as it allowed the attacker to open a CLMM position that required only a minimal amount of one token, leveraging the "single-sided / nearly single-token" liquidity behavior inherent in concentrated liquidity designs.

Flashloan used to manipulate Cetus pool price
Flashloan used to manipulate Cetus pool price

2. Add Liquidity with an "Almost Free" Deposit

Next, the attacker selected a very tight tick range (e.g., 300000–300200) and precisely tuned the target liquidity. In CLMM systems, token delta calculations are highly dependent on the square-root prices at the range boundaries, and narrow ranges can make certain intermediate values extremely sensitive to small changes.

By carefully tuning these parameters, the attacker caused an internal multiplication to produce a u256 intermediate value. This value should have overflowed when left-shifted, but it successfully passed the flawed checked_shlw() guard. As a direct consequence of the unsafe shift-induced truncation, the protocol calculated the required Token A amount as effectively 1 unit, while simultaneously minting and recording the position with a massive amount of liquidity (i.e., 10,365,647,984,364,446,732,462,244,378,333,008).

Cetus attacker adding liquidity with minimal deposit
Cetus attacker adding liquidity with minimal deposit

3. Remove Liquidity to Extract Real Reserves

With an on-chain position that falsely appeared to hold inflated liquidity, the attacker proceeded to remove liquidity and withdraw assets as if the position had been properly funded. This critical step is where the pool’s real reserves were systematically drained, leading to the substantial $223 million loss.

4. Repeat Across Multiple Pools

After successfully validating the exploit primitive, the attacker replicated the same workflow across multiple pools, rapidly compounding the total losses and executing one of the largest DeFi hacks to date.

Best Security Auditor for Web3

Validate design, code, and business logic before launch

Key Takeaways and Blockchain Security Lessons

The Cetus Incident serves as a stark reminder of the intricate challenges in blockchain security, especially within complex DeFi protocols. The root cause was a faulty overflow check around a u256 left shift in the fixed-point math path. This allowed an overflowed shift to silently truncate high bits, making the required deposit appear near-zero while still crediting an LP position with massive liquidity, ultimately enabling reserve extraction.

Lessons Learned for Smart Contract Security:

  • Strictness in Arithmetic: Be exceptionally rigorous when dealing with shifts, scaling factors, rounding, and boundary conditions in fixed-point arithmetic. These are common sources of critical vulnerabilities.
  • Proven Primitives: Prioritize the use of proven safe-math primitives or formalized invariants over developing ad-hoc helper functions. If custom helpers are necessary, validate their constants and thresholds with extreme care.
  • Comprehensive Testing: Implement extensive edge-case and property-based tests to cover maximum values, boundary ticks, and adversarial parameter combinations. This proactive approach can uncover subtle flaws before deployment.
  • Continuous Monitoring: Even with robust audits, real-time monitoring solutions are crucial. Tools like BlockSec's Phalcon Security can detect suspicious on-chain activities and potential exploits in progress, offering a vital last line of defense.

The Cetus Incident underscores the importance of a multi-layered approach to blockchain security, combining meticulous code review, advanced testing methodologies, and continuous on-chain monitoring to safeguard against sophisticated DeFi hacks.

Get Started with Phalcon Security

Detect every threat, alert what matters, and block attacks.

Try now for free

Reference

  1. Official Announcement of Cetus Protocol
  2. BlockSec's Short Analysis
  3. Transaction on Suiscan

About BlockSec

BlockSec is a full-stack blockchain security and crypto compliance provider. We build products and services that help customers to perform code audit (including smart contracts, blockchain and wallets), intercept attacks in real time, analyze incidents, trace illicit funds, and meet AML/CFT obligations, across the full lifecycle of protocols and platforms.

BlockSec has published multiple blockchain security papers in prestigious conferences, reported several zero-day attacks of DeFi applications, blocked multiple hacks to rescue more than 20 million dollars, and secured billions of cryptocurrencies.

Sign up for the latest updates
Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph
Partnership

Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph

BlockSec has partnered with Morph as an official audit partner for the $150M Morph Payment Accelerator. By offering exclusive discounts on smart contract audits and penetration testing, BlockSec provides institutional-grade security to payment builders, ensuring a safe and resilient foundation for the future of global stablecoin payments.

Weekly Web3 Security Incident Roundup | Mar 9 – Mar 15, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 9 – Mar 15, 2026

This BlockSec weekly security report covers eight DeFi attack incidents detected between March 9 and March 15, 2026, across Ethereum and BNB Chain, with total estimated losses of approximately $1.66M. Incidents include a $1.01M AAVE incorrect liquidation caused by oracle misconfiguration, a $242K exploit on the deflationary token MT due to flawed trading restrictions, a $149K exploit on the burn-to-earn protocol DBXen from `_msgSender()` and `msg.sender` inconsistency, and a $131K attack on AM Token exploiting a flawed delayed-burn mechanism. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Venus Thena (THE) Incident: What Broke and What Was Missed

Venus Thena (THE) Incident: What Broke and What Was Missed

On March 15, 2026, an attacker bypassed the THE (Thena) supply cap on Venus Protocol (BNB Chain) through a donation attack, inflating a collateral position to 3.67x the intended limit and borrowing ~$14.9M in assets. Both sides lost money on-chain: Venus was left with ~$2.15M in bad debt after 254 liquidation bots competed across 8,048 transactions, while the attacker retained only ~$5.2M against a $9.92M investment. This deep dive examines what broke across three lines of defense (exposure limits, collateral valuation, and liquidation) and the monitoring gaps that left months of on-chain warning signals unacted upon.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit

Get Real-Time Protection with Phalcon Security

Audits alone are not enough. Phalcon Security detects attacks in real time and blocks threats mid-flight.

phalcon security