Nemo合约安全漏洞致259万美元被盗,Sui链上资产安全再敲警钟

This article is not available in the current language yet. Showing the original version.
北京时间2025年9月7日,Sui链上的Nemo被攻击,黑客通过操作py_index以窃取约259万美元。此次Nemo被盗根本原因是PyState错误地设置为可变引用。

事件概述:

北京时间2025年9月7日,Sui链上的 Nemo 被攻击,黑客通过操作py_index以窃取约259万美元。

Attacker Address:

0x01229b3cc8469779d42d59cfc18141e4b13566b581787bf16eb5d61058c1c724

Attack Transaction:

https://suivision.xyz/txblock/HMMicxQWn43rnNswi4gNHanUaeiWW5ijqM5bHLca67D9?tab=Overview

Nemo Package:

0x0f286ad004ea93ea6ad3a953b5d4f3c7306378b0dcc354c3f4ebb1d506d3b47f

根本原因:

此次Nemo被盗根本原因是PyState错误地设置为可变引用,导致攻击者可以恶意修改py_index,在调用mint_py函数时通过py_index与分离出SY参数相乘得到大量的PT和YT。

经过深入分析发现,在py.get_sy_amount_in_for_exact_py_out 函数调用 py.current_py_index时允许传入一个毫无约束的数用于修改 pyState 的 py_index 字段。

·py.get_sy_amount_in_for_exact_py_out计算出PY输出所需要的SY的输入量,然而这里index没有任何限制

·py.current_py_index将传入的py_index和存储的index比较,返回最大的作为py_state.py_index_stored的最新值

攻击过程分析

1.攻击者调用 init_py_position 函数初始化一个 py_position(初始化用户的仓位记录,与本次攻击无关)。

2.接着利用闪电贷 py.borrow_pt_amount 借出大量PT代币(后续通过swap换取SY余额)。

3.调用100次market.swap_exact_pt_for_sy将PT兑换成SY代币。

4.通过py.get_sy_amount_in_for_exact_py_out计算出PY输出所需要的SY的输入量,这里攻击者将py_index传入一个构造的极大的数553402322211286548480000,破坏了原本的结构。

5.接着攻击者利用被异常放大的指数,在调用 yield_factory.mint_py 时,以畸高的折扣利率铸造 PT 与 YT,从而套取大量 PT。

MintEvent如下:

6.最后攻击者使用铸造的PT通过 py.repay_pt_amount 偿还债务,然后通过redeem赎回收益型资产,并在Scallop中提取代币。

至此攻击者通过操作 py_index 已盗取大约259万美元,之后将资产转换为USDC并通过Bridge进行跨链转移,最终转换为ETH和DAI存储在 0x41b1906c4BCded607c6b02861cE15C2E49FF7576。

在攻击发生后Nemo团队紧急暂停了智能合约功能,并开始调查攻击事件。调查结果表明259万美元资产损失攻击源于在未充分审计的情况下上线新功能。

事件总结:

此次攻击的核心在于将敏感数据错误的设置为可写状态导致攻击者可以自由传入参数并进行修改,对于敏感数据的状态应做好严格限制和检查。

Share to:

Author: ExVul Security

Opinions belong to the column author and do not represent PANews.

This content is not investment advice.

Image source: ExVul Security. If there is any infringement, please contact the author for removal.

Follow PANews official accounts, navigate bull and bear markets together
PANews APP
Reports indicate that one crew member of the US fighter jet shot down over Iran has been rescued.
PANews Newsflash