🎉 The #CandyDrop Futures Challenge is live — join now to share a 6 BTC prize pool!
📢 Post your futures trading experience on Gate Square with the event hashtag — $25 × 20 rewards are waiting!
🎁 $500 in futures trial vouchers up for grabs — 20 standout posts will win!
📅 Event Period: August 1, 2025, 15:00 – August 15, 2025, 19:00 (UTC+8)
👉 Event Link: https://www.gate.com/candy-drop/detail/BTC-98
Dare to trade. Dare to win.
Euler Finance suffered a flash loan attack, resulting in a loss of nearly 200 million dollars.
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.
Attack Process Analysis
The main steps of the attacker are as follows:
Borrowed 30 million DAI from a lending platform using Flash Loans, and deployed two contracts for lending and liquidation.
Stake 20 million DAI into the Euler Protocol contract to receive 19.5 million eDAI.
Use Euler Protocol's 10x leverage feature to borrow 195.6 million eDAI and 200 million dDAI.
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.
Donate 100 million eDAI through the donateToReserves function, then call the liquidate function to liquidate and obtain 310 million dDAI and 250 million eDAI.
Finally, extract 38.9 million DAI, repay 30 million Flash Loans, and the net profit is approximately 8.87 million DAI.
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.
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:
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.