Euler Finance suffered a flash loan attack, resulting in a loss of nearly 200 million dollars.

robot
Abstract generation in progress

Euler Finance遭遇flash loan attack,损失近2亿美元

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

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

Attack Process Analysis

The main steps of the attacker are as follows:

  1. Borrowed 30 million DAI from a lending platform using Flash Loans, and deployed two contracts for lending and liquidation.

  2. Stake 20 million DAI into the Euler Protocol contract to receive 19.5 million eDAI.

  3. Use Euler Protocol's 10x leverage feature to borrow 195.6 million eDAI and 200 million dDAI.

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

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

  6. Finally, extract 38.9 million DAI, repay 30 million Flash Loans, and the net profit is 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 USD!

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

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

Cause of the Vulnerability

The core of the attack lies in the absence of necessary liquidity checks in the donateToReserves function of the Euler Finance contract. Unlike other key functions such as mint, the donateToReserves function does not call checkLiquidity for user liquidity verification. This allows attackers to place themselves in a liquidatable state through specific operations and then complete the liquidation for profit.

Under normal circumstances, the checkLiquidity function would call the RiskManager module to ensure that the user's Etoken is always greater than the Dtoken, maintaining the security of the contract. However, the donateToReserves function skipped this important step, resulting in a serious security vulnerability.

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

Lessons and Recommendations

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

  1. Integrity of the funds repayment mechanism
  2. The comprehensiveness of liquidity detection
  3. The Security of the Debt Liquidation Process

The project team should conduct a comprehensive security audit before launching to ensure that every function of the contract has undergone rigorous security checks. Additionally, continuous security monitoring and a bug bounty program are also effective measures to ensure the long-term security of the project.

In addition, developers should pay attention to consistency between functions, ensuring that key security checks (such as liquidity checks) are correctly implemented across all relevant functions. This not only includes main functions but should also cover auxiliary functions such as donations.

Finally, it is recommended that project teams and developers remain vigilant against emerging attack methods and regularly update security strategies to address the evolving threats to blockchain security.

EUL5.81%
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
  • 7
  • Share
Comment
0/400
StableGeniusvip
· 6h ago
well well well... as predicted, another protocol learns about mathematical rigour the hard way. empirically speaking, this was inevitable.
Reply0
SelfCustodyBrovip
· 6h ago
Just lying down and enjoying the gossip~
View OriginalReply0
PoetryOnChainvip
· 6h ago
Another crispy contract is doomed.
View OriginalReply0
MevHuntervip
· 6h ago
Another Rug Pull has occurred in the contract sale.
View OriginalReply0
SorryRugPulledvip
· 6h ago
A contract without a technical audit is also like giving away money.
View OriginalReply0
0xInsomniavip
· 6h ago
Again seeing smart contracts vulnerabilities
View OriginalReply0
GasFeeNightmarevip
· 6h ago
Staying up late watching gas almost made me lose everything... seven out of ten trades failed, and I still have to pay the Miner an IQ tax.
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)