Inverse Finance被盗1450万美元事件分析

Certik2022-04-03 tarihinde yayınlandı2022-04-03 tarihinde güncellendi

Özet

该事件发生的根本原因在于外部价格预言机依赖导致价格被操纵,因此攻击者可通过操纵价格来借用资产。

北京时间2022年4月2日19时,CertiK安全技术团队监测到Inverse Finance被恶意利用,导致价值约1450万美元的资产受到损失。
该事件发生的根本原因在于外部价格预言机依赖导致价格被操纵,因此攻击者可通过操纵价格来借用资产。
攻击流程
在发起攻击之前,攻击者做了如下准备: 
1. 首先,攻击者部署了一个恶意合约。该合约地址为:0xea0c959bbb7476ddd6cd4204bdee82b790aa1562
2. 其次,攻击者在SushiSwap/Curve.fi中进行调换,以操纵交易中的价格,该交易地址为:0x20a6dcff06a791a7f8be9f423053ce8caee3f9eecc31df32445fc98d4ccd8365
由于SushiSwap:INV(INV-ETH Pair)的流动性非常低,用300ETH(价值约一百多万美元)换取INV将大幅增加INV价格。
随后,攻击者正式发起攻击:
1. 攻击者把在准备阶段获得的INV存入,并铸造(mint)了1746枚XINV代币。
2. XINV的价格计算:根据SushiSwap:INV对中的INV价格所计算。如上所述,INV的价格被操纵,因此每XINV的价值为20926美元。
3. 随着XINV的价格被修改,攻击者能够用铸造的XINV代币借用到如下资产:1588枚ETH,94枚WBTC,3999669枚DOLA与39枚YFI。
合约漏洞分析
该漏洞主要原因是对价格预言机具有依赖性,并且这中间有30分钟的窗口期。而攻击在准备阶段完成后正式发生,仅仅用了15秒。

预言机

在这种情况下,因为timeElapsed == 15,预言机合约Keep3rV2Oracle的函数_update()中'timeElapsed > periodSize'的检查将被绕过。这意味着最后的累积价格还没有被更新。由此可见,函数_computeAmountOut()中的amoutOut会比预期的数额大,因为priceCumulative已经被操纵了,但_observation.priceCumulative没有被更新。

预言机

一方面,XINV的价格依赖于SushiSwap:INV 对(INV-ETH对)的储备,其流动性非常低。
另一方面,TWAP可以防止闪电贷攻击。理论上,攻击者能够通过 "牺牲 "一些钱来操纵价格,也就是说,用他自己的钱来改变价格。在这个特殊的价格预言机设计中,如果经过的时间没有超过30分钟,当前的价格(来自储备金)不应该被用来计算出金金额。
资产追踪
据CertiK SkyTrace显示,价值约1450万美元的资产被盗后已被转移到Tornado Cash。

预言机

其他细节
利用漏洞进行交易的准备期间: 
https://etherscan.io/tx/0x20a6dcff06a791a7f8be9f423053ce8caee3f9eecc31df32445fc98d4ccd8365
利用漏洞进行交易发起攻击: 
https://etherscan.io/tx/0x600373f6752132https://etherscan.io/tx/0x600373f67521324c8068cfd025f121a0843d57ec813411661b07edc5ff781842
攻击者地址1:https://etherscan.io/address/0x117c0391b3483e32aa665b5ecb2cc539669ea7e9
攻击者地址2: https://etherscan.io/address/0x8b4c1083cd6aef062298e1fa900df9832c8351b3
攻击合约: 
https://etherscan.io/address/0xea0c959bbb7476ddd6cd4204bdee82b790aa1562
预言机合约: 
https://etherscan.io/address/0x39b1df026010b5aea781f90542ee19e900f2db15#code
SushiSwap INV-ETH Pair: 
https://etherscan.io/address/0x328dfd0139e26cb0fef7b0742b49b0fe4325f821
XINV 合约地址: https://etherscan.io/address/0x1637e4e9941d55703a7a5e7807d6ada3f7dcd61b#code
Keep3rV2 预言机合约地址: 
https://etherscan.io/address/0x39b1df026010b5aea781f90542ee19e900f2db15#code
​写在最后
现如今,很多项目都会用到预言机,部分项目还会对其具有很强的依赖性。安全审计,会审查预言机的设计合理性、价格算法以及经济模型等。
因此,CertiK的安全专家建议:尽量避免使用流动性低的池子作为价格预言机价格来源,同时对项目进行安全审计从而保证预言机模型的正确性。

İlgili Okumalar

Why P2P and Exchangers Are Becoming Obsolete, and What Will Replace Them

Titled "Why P2P and Exchanges Are Becoming Obsolete, and What Will Replace Them," this article discusses the evolution of stablecoins, particularly USDT, from a trading tool to a global payment method. However, converting crypto back to fiat for daily expenses remains a challenge. The process of using P2P platforms or crypto exchanges has become increasingly risky and complex due to stricter banking anti-fraud measures, new legislation in Russia, and rampant fraud schemes like "triangles," where sellers can inadvertently receive stolen funds. The article highlights that while P2P was convenient, banks now scrutinize frequent peer-to-peer transfers, often freezing accounts. Exchanges also pose risks like unfavorable rates and unclear compliance. The market is therefore shifting towards integrated services that eliminate the manual conversion step. It cites OneSix as an example—a crypto wallet accessible via Telegram and web that embeds currency conversion directly into payment and withdrawal scenarios. Users can pay bills or send money as if using a bank app, with the crypto-to-fiat exchange happening seamlessly in the background. It also offers invoicing for freelancers and conducts AML checks, returning suspicious transactions instantly instead of freezing them. In conclusion, as crypto integrates into everyday finance, the demand for manual, risky exchange methods is declining. The future lies in unified platforms that combine storage, compliance, conversion, and payments into a single, secure user experience.

cryptonews.ru55 dk önce

Why P2P and Exchangers Are Becoming Obsolete, and What Will Replace Them

cryptonews.ru55 dk önce

The CEO of MARA Holdings Compares AI Operations to Bitcoin Mining! Which is More Profitable?

Fred Thiel, CEO of MARA Holdings (a major Bitcoin mining company), states that the rapid growth of the artificial intelligence (AI) sector is transforming mining companies' business models. He claims that powering data centers for AI is significantly more profitable than Bitcoin mining. In a recent interview, Thiel explained why many mining firms are diversifying into AI infrastructure. According to Thiel, the energy demands of data centers are surging, especially due to the spread of generative AI applications. This creates new revenue opportunities for Bitcoin mining companies with robust power infrastructure. MARA Holdings is among those monitoring this shift and aims to develop its energy and infrastructure services for AI data centers. Thiel emphasized that this move toward AI does not mean the end of Bitcoin mining. He stated that Bitcoin mining remains a sustainable business model, especially for miners in regions with low electricity costs, and it is still a crucial field for utilizing excess or idle power capacity. In recent years, many Bitcoin mining companies have begun using their energy-intensive infrastructure not just for block production but also for high-performance computing (HPC) and AI applications. This strategy aims to diversify revenue sources and increase resilience against cryptocurrency market volatility. Analysts note that the growing energy demand in the AI sector presents significant transformation opportunities for mining companies. The need for high-power, uninterrupted electricity supply, particularly for large data centers, gives Bitcoin miners with existing energy infrastructure expertise a considerable advantage.

cryptonews.ru1 saat önce

The CEO of MARA Holdings Compares AI Operations to Bitcoin Mining! Which is More Profitable?

cryptonews.ru1 saat önce

İşlemler

Spot
活动图片