Euler Finance suffered a $200 million flash loan attack due to a smart contracts vulnerability.

Euler Finance suffers a flash loan attack, resulting in losses of nearly 200 million dollars.

On March 13, 2023, the Euler Finance project suffered a flash loan attack due to a vulnerability in its smart contract, resulting in a loss of approximately $197 million. The attacker exploited the lack of liquidity checks in the donateToReserves function of the contract to obtain substantial profits through multiple operations.

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million USD!

Attack Process Analysis

  1. The attacker first borrowed 30 million DAI from a lending platform using Flash Loans and deployed two contracts: a lending contract and a liquidation contract.

  2. Stake 20 million of the borrowed DAI into the Euler Protocol contract to obtain approximately 19.5 million eDAI.

  3. Utilize the 10x leverage feature of the Euler Protocol to borrow 195.6 million eDAI and 200 million dDAI.

  4. Use the remaining 10 million DAI to repay part of the debt and burn the corresponding dDAI, then borrow the same amount of eDAI and dDAI again.

  5. Call the donateToReserves function to donate 100 million eDAI, then liquidate through the liquidate function to obtain 310 million dDAI and 250 million eDAI.

  6. Finally, withdraw 38.9 million DAI, repay the Flash Loans of 30 million DAI, netting approximately 8.87 million DAI.

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million USD!

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Loss of 197 Million USD!

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million Dollars!

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million USD!

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million Dollars!

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million Dollars!

Euler Finance Vulnerability Analysis: How to Suffer a Flash Loan Attack, Losing $197 Million!

Euler Finance Vulnerability Analysis: How to Suffer a Flash Loan Attack, Losing 197 Million USD!

Euler Finance Vulnerability Analysis: How It Suffered a Flash Loan Attack, Losing 197 Million USD!

Cause of Vulnerability

The main reason for the success of the attack is that the donateToReserves function lacks the necessary liquidity checks. Unlike other key functions (such as mint), donateToReserves does not call the checkLiquidity function to validate the user's liquidity status. This allows the attacker to manipulate their own account into a state that can be liquidated and profit from it.

Under normal circumstances, the checkLiquidity function calls the RiskManager module to ensure that the user's Etoken amount is greater than the Dtoken amount, in order to maintain the health of the account. However, the donateToReserves function skips this critical step, creating an opportunity for an attack.

Euler Finance Vulnerability Analysis: How to Suffer a flash loan attack, Losing 197 Million Dollars!

Lessons and Suggestions

This incident once again highlights the importance of security audits for smart contracts. For lending projects, special attention should be paid to the following aspects:

  1. The integrity of the capital repayment mechanism
  2. The comprehensiveness of liquidity detection
  3. The security of the debt liquidation process

The project team should conduct a comprehensive and rigorous security audit before the contract goes live to ensure the safety and stability of the contract. At the same time, continuous security monitoring and timely vulnerability remediation are also indispensable.

With the rapid development of decentralized finance, similar security incidents may continue to arise. Developers and project teams need to remain vigilant, continuously learn and improve, in order to build a more secure and reliable blockchain ecosystem.

EUL5.11%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 6
  • Repost
  • Share
Comment
0/400
ChainComedianvip
· 11h ago
Another bull project has flipped.
View OriginalReply0
OfflineNewbievip
· 11h ago
Suckers have been played for suckers again~
View OriginalReply0
SmartMoneyWalletvip
· 11h ago
197 million USD? This operation is too primitive, although the amount of funds is not small.
View OriginalReply0
SolidityStrugglervip
· 11h ago
Once again, the smart contracts are the scapegoat.
View OriginalReply0
MetaRecktvip
· 11h ago
Again trapped.
View OriginalReply0
FadCatchervip
· 11h ago
Another Rug Pull project
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)