Euler Finance suffered a $197 million flash loan attack, raising alarms for DeFi security.

robot
Abstract generation in progress

Euler Finance suffered a flash loan attack, losing nearly 200 million dollars.

On March 13, 2023, the Euler Finance project suffered a major flash loan attack, resulting in a loss of approximately $197 million. This attack involved six different tokens and is one of the largest security incidents in the DeFi space in recent times.

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

Analysis of the Attack Process

The attacker first obtained a Flash Loans of 30 million DAI from a lending platform, and then deployed two key contracts: one for the lending operation and the other for liquidation.

The main steps of the attack are as follows:

  1. Stake 20 million DAI in the Euler Protocol to receive 19.5 million eDAI.

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

  3. Use the remaining 10 million DAI to repay part of the debt and burn the corresponding dDAI.

  4. Borrow the same amount of eDAI and dDAI again.

  5. Donate 100 million eDAI through the donateToReserves function, then trigger liquidation to obtain 310 million dDAI and 250 million eDAI.

  6. Finally, withdraw 38.9 million DAI, repay the Flash Loans principal of 30 million DAI, with a net profit of 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, 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 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 USD!

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 USD!

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

Vulnerability Reason

The core issue of this attack lies in the lack of necessary liquidity checks in the donateToReserves function of Euler Finance. Unlike other key functions (such as mint), donateToReserves does not call the checkLiquidity function to verify the user's asset status.

Under normal circumstances, checkLiquidity would call the RiskManager module to ensure that the user's eToken amount is always greater than the dToken amount. However, since the donateToReserves function skipped this step, the attacker was able to manipulate their own account into a liquidatable state, thereby carrying out the attack.

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

Security Recommendations

For DeFi projects, especially platforms that involve lending functions, special attention needs to be paid to the following points:

  1. Ensure that all critical functions include necessary security checks, especially liquidity validation.

  2. Conduct a comprehensive security audit before the contract goes live, focusing on core aspects such as fund repayment, liquidity detection, and debt clearance.

  3. Regularly conduct code reviews and vulnerability scans to timely identify and fix potential risks.

  4. Establish a sound risk management mechanism, set reasonable borrowing limits and liquidation thresholds.

  5. Consider introducing additional security measures such as multi-signature or time locks to prevent rapid loss of large amounts of funds.

This incident once again highlights the importance of security in DeFi. Project teams should continuously strengthen their security awareness and adopt multi-layered protective measures to ensure the safety of user assets. At the same time, users should remain vigilant when participating in DeFi projects and understand the potential risks.

EUL-9.39%
DEFI-2.35%
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
DAOdreamervip
· 07-26 01:35
Maintaining security is paramount, auditing is really important.
View OriginalReply0
StakeHouseDirectorvip
· 07-25 22:05
Another project has been taken away, it's gone, it's gone.
View OriginalReply0
GasWastervip
· 07-23 02:23
The malicious Hacker is on the loose again.
View OriginalReply0
MemecoinResearchervip
· 07-23 02:19
running sentiment analysis... aaand it's gone
Reply0
ForkThisDAOvip
· 07-23 02:14
Another one that went live without security checks.
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)