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

avatar
成都链安
4 years ago
This article is approximately 247 words,and reading the entire article takes about 1 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.

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

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

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:

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

△Figure 2

image description

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

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

△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.

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

△Figure 4

image description

△Figure 4

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

Here, lets look at the attackers first step in the attack, as shown in the following figure:

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

△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

Original article, author:成都链安。Reprint/Content Collaboration/For Reporting, Please Contact report@odaily.email;Illegal reprinting must be punished by law.

ODAILY reminds readers to establish correct monetary and investment concepts, rationally view blockchain, and effectively improve risk awareness; We can actively report and report any illegal or criminal clues discovered to relevant departments.

Recommended Reading
Editor’s Picks