BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Chengdu Lianan: Analysis of DeFi Project Yearn Finance Flash Loan Attack Event

Beosin
特邀专栏作者
This article is about 1137 words, reading the full article takes about 2 minutes
The specific method of this attack was that the attacker used flash loans to borrow huge amounts of funds, and then carried out circular arbitrage.
AI Summary
Expand
The specific method of this attack was that the attacker used flash loans to borrow huge amounts of funds, and then carried out circular arbitrage.

1. Event overview

secondary title

In short, the specific method of this attack is that the attacker borrowed a huge amount of money using flash loans, and then carried out circular arbitrage. According to the response and analysis of the Chengdu Beosin security team, the contract involved in this attack is yValut+Curve Pool.

2. Event analysis

2. Event analysis

1. The attacker deposits DAI in the yVault contract, and calls earn to trigger yValut to add liquidity to the liquidity pool using DAI, as shown in the figure below:

image description

2. The attacker uses the borrowed funds to add liquidity to the liquidity pool using USDT to obtain Curve tokens, as shown in the figure below:

△Figure 2

image description

3. The attacker takes out the DAI stored in the yValut contract, as shown in the figure below:

△Figure 3

image description

4. The attacker specifies the same amount of USDT as when adding liquidity, and removes the liquidity. Note that because a part of DAI is taken away at #3, the price of USDT will drop relative to #2, so the remaining part of Curve will be replaced here. currency.

△Figure 4

image description

△Figure 4

The above cycle continues, which allows the attacker to consume DAI to obtain Curve tokens.

Here, let's look at the attacker's first step in the attack, as shown in the following figure:

△Figure 5

image description

In addition to this part of the loss, the attacker also obtained more Curve tokens, thus making a profit.

3. Security Recommendations

secondary title

3. Security Recommendations

DeFi
Safety
Welcome to Join Odaily Official Community