Popular version: A simple "translation" to interpret the analysis of the @CetusProtocol hacker by the tech boss:
This attack exposes a classic integer overflow problem, which is manifested in data truncation during type conversion.
Technical details disassembled:
1) Vulnerability location: The problem occurs in the type conversion mechanism of the get_amount_by_liquidity function, and the cast conversion from U256 to U64 causes high-level data loss.
2) Attack process:
1. The attacker passes in a large amount of liquidity parameters through the add_liquidity function;
2. The number of B tokens required for system call get_delta_b function calculation;
3. In the calculation process, the two U128 type data are multiplied, and the theoretical result should be U256 type;
Key flaw: The u256 result is cast to u64 when the function returns, resulting in the truncation of the high-level 128-bit data.
3) Utilization effect: The liquidity quota that originally required a large number of tokens to mint can now be completed with only a very small number of tokens. The attacker obtains a huge share of liquidity at a very low cost, and then realizes the arbitrage of the pool by destroying part of the liquidity.
Simple analogy: Just like using a calculator that can only display 8 digits to calculate 1 billion × 1 billion, the result of a 20-digit calculation can only display the last 8 digits, and the first 12 digits disappear directly. The attacker exploits this vulnerability.
To be clear: this vulnerability has nothing to do with @SuiNetwork's underlying security architecture, and the security "glory" of the Move language is still credible for the time being. Why?
The Move language does have significant advantages in terms of resource management and type security, and can effectively prevent low-level security problems such as double spending and resource leakage. However, this time the Cetus protocol is a mathematical error at the level of application logic, not a design flaw in the Move language itself.
Specifically, Move's type system, while rigorous, still relies on the developer's right judgment for explicit casting. When a program actively performs a type conversion from U256 to U64, the compiler cannot tell if this is intentional or a logical error.
In addition, this security incident has nothing to do with Sui's core underlying functions such as consensus mechanism, transaction processing, and state management. Sui Network only faithfully executes the transaction instructions submitted by the Cetus protocol, and the vulnerability stems from the logical flaws of the application layer protocol itself.
To put it bluntly, no amount of advanced programming languages can completely eliminate logical errors at the application layer. Move can prevent most of the underlying security risks, but it cannot replace developers with bounds checking of business logic and overflow protection of mathematical operations.
After investigating the Cetus exploit transaction, I believe I have identified the root cause of the bug. The issue stems from a type casting from u256 to u64 within the get_amount_by_liquidity function.
151
53.48K
The content on this page is provided by third parties. Unless otherwise stated, OKX is not the author of the cited article(s) and does not claim any copyright in the materials. The content is provided for informational purposes only and does not represent the views of OKX. It is not intended to be an endorsement of any kind and should not be considered investment advice or a solicitation to buy or sell digital assets. To the extent generative AI is utilized to provide summaries or other information, such AI generated content may be inaccurate or inconsistent. Please read the linked article for more details and information. OKX is not responsible for content hosted on third party sites. Digital asset holdings, including stablecoins and NFTs, involve a high degree of risk and can fluctuate greatly. You should carefully consider whether trading or holding digital assets is suitable for you in light of your financial condition.