compound因uni瞬间拉盘而产生66万美元的坏账

币圈资讯 阅读:32 2024-04-22 04:58:21 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

昨天晚上(2024.2.23)uni瞬间拉盘,价格从7美元,一瞬间涨到了11美元。

compound这个借贷协议是允许用户抵押其他币(如usdc)借uni,就在这个uni瞬间拉盘之后的一小段时间里,compound没有及时更新uni的价格,导致在协议里可以用低uni价值的抵押品去借走uni。

这被极少数几个人发现后抵押usdc借走了大量的uni,然后卖掉uni变成usdc,然后你会发现,它获得的usdc数量竟然多于他抵押进compound的数量。

我来认真分析一下这次对借贷协议的攻击,数据来源https://bad-debt.riskdao.org/。

攻击获利的地址有下面四个

0x6980a47bee930a4584b09ee79ebe46484fbdbdd0

0x5968ada261a84e19a6c85830e655647752585ed4

0x49bc3cec1fb7978746f742a4e485d0d601831cea

0x2f99fb66ea797e7fa2d07262402ab38bd5e53b12

现在在debank上去查看这四个地址的余额,你会发现在compound这个协议里,这四个地址都有一笔债务,但抵押品几乎为零,如下面:

这个截图显示,这个地址0x2f99fb66ea797e7fa2d07262402ab38bd5e53b12在compound抵押了1.1503Dai和0.051715usdc,但借走了28702.7973uni 。

抵押品几乎为0,但借走的uni价值高达 33万U。这种情况下,这个地址肯定是不会去还这笔uni债务的。

其他三个地址都一样,使用了几乎为零的抵押品,借走了十几万U的uni币。

这四个地址累计借走了 55,565.9001uni,目前按12U一个计算,总价值是 55565.9*12=666790.8 usdt,66万U亏损。

为什么会发生可以使用几乎为0抵押品,却能借卖几十万U的uni币?

整个攻击逻辑是下面这样的:

1.假设现在是T0时间点,uni在市场上的价格是7U/unicompounduni的喂价正常,也是7U/uni

2.然后在T1时间点,uni在市场上的价格突然爆涨,瞬间涨到了11U/uni。但compound里对uni的喂价出现错误,还是停留在7U/uni

3.然后有人发现了compounduni的喂价错误,立刻抵押了20usdc进去compound充当抵押品,并顶格借走了uni币,按compound的喂价(7u/uni,和85%的借贷率),可以借走 20*0.85=17 万U的uni, 170000/7=24285.7143 uni,即可以借走 2.4万uni。

4.然后将这2.4uni在市场上(比如uniswap v3)卖掉换成usdc,因为市场上的价格是 11U/uni,因此可以卖到 2.4*11=26.4 wUsdc,比抵押品多了  6.4万Usdc,这就是利润。

下面这笔交易 https://etherscan.io/tx/0xaee0f8d1235584a3212f233b655f87b89f22f1d4890782447c4ef742b37af58d 可以非常清晰地看到上面的逻辑

它抵押了 193020usdc,借出了19748uni,并且将uni卖成了ETH然后ETH又卖成了usdc,最终收到195461usdc,比抵押品多了195461-193020=2441 usdc。

5.compound将正确的uni币价格喂进协议后,那这些债务肯定要被清算,并且还清算不干净,即使清算者拿走所有的抵押品,也还会留下大量的uni债务。这就是坏账。

compound为什么会出现uni价格喂价错误?

目前compound已经发起了修正这个bug的投票。

因为compounduni币的价格设定是采用了双重保险,一个是采用chainlinkoracle喂价,另外同时还采用了Uniswap TWAP(时间加权平均价格)。但这两个喂价具体是怎么取舍我没去查。但从现在的结果来看,这两者必须同时正常,compound才能正常喂价。

在uni价格瞬间爆涨时,chainlink的喂价是正常的,但UniswapTWAP的价格出现了问题,compound的协议给出了错误的价格。


Last night, the price of the instant offer rose from US dollars to US dollars. This loan agreement allows users to mortgage other currencies. If the price is not updated in time for a short time after the instant offer, it can be borrowed with low-value collateral. After being discovered by a few people, the mortgage borrowed a lot and then sold it. Then you will find that the amount it obtained is actually more than the amount he mortgaged. Let me carefully analyze the number of attacks on the loan agreement. According to the source attack, there are the following four addresses that make profits. Now, if you look up the balance of these four addresses, you will find that in this agreement, all four addresses have a debt, but the collateral is almost zero. As the screenshot below shows, this address is mortgaged, but the collateral borrowed is almost zero, but the borrowed value is as high as ten thousand. In this case, this address will definitely not pay off this debt. The other three addresses all used almost zero collateral and borrowed hundreds of thousands of coins. These four addresses are tired. The whole attack logic is as follows: it is assumed that the price in the market is right at the moment, and the price in the market is normal, and then the price in the market suddenly exploded at the moment, but the price in the market was wrong or stayed, and then someone found the wrong price, and immediately mortgaged 10,000 to act as collateral and borrowed the money. You can borrow 10,000 yuan from the loan rate, that is, you can borrow 10,000 yuan, and then change this 10,000 yuan into the market, for example, because the market price is so that it can be sold more than the collateral. This is the profit. You can clearly see the logic above in this transaction. It is mortgaged, lent and sold, and then sold. After the correct currency price is fed into the agreement, these debts will definitely be liquidated, even if the liquidator takes all of them. The collateral will also leave a lot of debts, which is why the bad debts are wrong in price and price. At present, a vote has been initiated to correct this, because the price setting of coins is double insurance, one is the price, and the time-weighted average price is also used. But I didn't check how these two prices are chosen, but judging from the current results, the two prices must be normal at the same time to be normal. The price is normal when the price suddenly rises, but the agreement with the price problem gives the wrong price. 比特币今日价格行情网_okx交易所app_永续合约_比特币怎么买卖交易_虚拟币交易所平台

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=57581

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友