Cointime

Download App
iOS & Android

A Detailed Analysis of Euler Finance’s $197 Million Flash Loan Attack

Validated Project

On 13 March 2023 at 08:56:35 AM +UTC, DeFi lending protocol Euler Finance experienced a Flash Loan Attack.

Euler Finance is a protocol that operates as a permissionless lending protocol. Its primary goal is to facilitate lending and borrowing of various cryptocurrencies for users. The UK-based tech startup utilizes mathematical principles to develop non-custodial protocols on Ethereum and other blockchain networks, with a focus on achieving high performance.

Based on on-chain data analysis, the attacker has successfully executed multiple transactions resulting in the theft of approximately $197 million, making it the largest hack of 2023 thus far. Stolen assets include several million worth of DAI, USDC, Staked Ether (StETH), and Wrapped Bitcoin (WBTC).

The breakdown of the stolen assets are as follows:

Detailed Analysis

The attack was possible due to a lack of liquidity checks in the donateToReserves function of the Etoken. The attacker executed multiple calls with different currencies to generate profit, resulting in a massive loss of $196 million across six different tokens. Currently, the funds remain in the attacker’s account.

The attacker’s address is: https://etherscan.io/address/0xb66cd966670d962c227b3eaba30a872dbfb995db

The attacker’s contract address is: https://etherscan.io/address/0x036cec1a199234fc02f72d29e596a09440825f1c

One of the attack transactions can be found here: https://etherscan.io/tx/0xc310a0affe2169d1f6feec1c63dbc7f7c62a887fa48795d327d4d2da2d6b111d

1. The attacker first borrowed 30 million DAI through a flash loan from Aave and then deployed two contracts: one for lending and one for liquidation.

2. The attacker then called the deposit function and pledged 20 million DAI to the Euler Protocol contract, receiving 19.5 million eDAI in return.

3. The Euler Protocol allows users to borrow up to 10 times their deposit by calling the mint function. The attacker leveraged this capability to borrow 195.6 million eDAI and 200 million dDAI.

4. The attacker called the repay function using the remaining 10 million DAI borrowed through the flash loan to repay their debt and destroy 10 million dDAI. They then proceeded to call the mint function again to borrow 195.6 million eDAI and 200 million dDAI.

5. The attacker then called the donateToReserves function and donated 10 times the amount needed to repay their debt, sending 100 million eDAI. They then called the liquidate function to initiate the liquidation process and obtained 310 million dDAI and 250 million eDAI.

6. The attacker called the withdraw function and obtained 38.9 million DAI, which they used to repay the 30 million DAI borrowed through the flash loan. They profited 8.87 million DAI from the attack.

Core Vulnerability

First, let’s take a look at the donateToReserves function, which is where users become vulnerable to liquidation.

Comparing the donateToReserves function to the mint function in the diagram below, we can see that a key step, checkLiquidity, is missing from the donateToReserves function.

Next, we followed up and examined the implementation of checkLiquidity. We discovered the Call InternalModule function, which calls the RiskManager to check and ensure that Etoken > Dtoken for the user.

It is necessary to check the user’s liquidity each time an operation is performed by calling checkLiquidity.

However, the donateToReserves function does not execute this operation, allowing users to first put themselves in a state of liquidation through certain functions of the protocol, and then complete the liquidation.

Attack Reproduction

The Numen Cyber Lab’s team has managed to reproduce the attack.

You may find out more details on the PoC at https://github.com/numencyber/SmartContractHack_PoC/tree/main/EulerfinanceHack

Conclusion

Euler Finance have confirmed the attack on their official Twitter (@eulerfinance) and have stated that they are currently collaborating with security professionals and law enforcement to address the issue.

The recent attack on the Euler Finance protocol highlights the importance of implementing rigorous security measures, such as conducting thorough audits and regularly checking for vulnerabilities.

As the decentralized finance ecosystem continues to grow, it is crucial for projects to prioritize the security of their users’ funds and adopt best practices to mitigate the risk of similar attacks in the future.

Note

This article was originally posted on our website’s blog. Subsequent articles will be posted first on our website and Medium after a slight delay.

Please stay tuned and follow our Twitter @numencyber for any future updates.

Comments

All Comments

Recommended for you

  • Nasdaq Composite Index Surpasses June High, Sets New Record

    On September 22, the Nasdaq Composite Index expanded its early gains to 0.34%, reaching a new record high of 27,214.65 points.

  • Trump Expresses Desire to Meet Iranian Officials in New York if 'Conditions are Right'

    On September 22, CNN reported that U.S. President Trump has told his advisors that he hopes to meet with Iranian officials in New York if 'conditions are right.' The official stated that this meeting could also involve some of Trump's senior advisors who are accompanying him in New York, although no meetings have been scheduled yet. The official also mentioned that it is currently unclear whether Iran is willing to hold a potential meeting. Both Secretary of State Rubio and U.S. Ambassador to the United Nations Thomas-Greenfield have indicated that Trump is 'open' to meeting with Iranian officials.

  • Central Bank Reiterates: No Participation in Virtual Currency Activities

    On September 22, the People's Bank of China released financial education promotional content, reiterating the risks associated with virtual currencies. The central bank clarified that virtual currencies such as Bitcoin, Ethereum, and Tether are not legal tender, do not possess legal compensation, and cannot circulate in the market. Engaging in virtual currency-related businesses within the country is considered illegal financial activity and will be banned by law; foreign institutions are prohibited from illegally providing virtual currency services to domestic entities, and without permission, they cannot issue stablecoins pegged to the Renminbi abroad. The central bank advises the public to be cautious of virtual currency projects that claim high returns and guaranteed profits; do not participate in virtual currency trading, mining, or investment; refrain from joining cryptocurrency trading groups or visiting foreign trading platforms; do not lend bank cards or payment accounts, and refuse to act as currency dealers, U dealers, or fund runners. Any discovery of related illegal activities can be reported to regulatory authorities.

  • Kalshi Requests CFTC Approval for Margin Trading on Its Platform

    On September 22, event prediction platform Kalshi requested the U.S. Commodity Futures Trading Commission (CFTC) to allow margin trading on its platform.

  • CME to Launch BCH and Uniswap Futures to Expand Crypto Derivatives Portfolio

    On September 22, according to market news, the CME will launch BCH (Bitcoin Cash) and Uniswap futures to expand its crypto derivatives portfolio.

  • Binance Acquires $100 Million in Circle Shares at a Discount

    On September 22, Circle (CRCL) filed an 8-K document indicating that its subsidiary entered into a new five-year cooperation agreement with Binance on September 17 to expand the promotion of USDC, replacing previous agreements signed in November 2024 and August 2025. Circle will pay Binance monthly incentive fees based on the amount of USDC held through its modular smart contract wallet infrastructure services. On the same day, Binance subscribed to 1,237,011 shares of Class A common stock of Circle at a discounted price of $80.84 per share, totaling $100 million, with the transaction completed. The related shares are generally subject to a two-year transfer restriction, but there are provisions for early termination and other exceptions.

  • BTC Surpasses $86,000

    Market data shows that BTC has surpassed $86,000, currently priced at $86,009.97, with a 24-hour increase of 2.57%. The market is experiencing significant volatility, so please ensure proper risk management.

  • Spot Gold Falls Below $4,300

    On September 22, spot gold fell below $4,300 per ounce, with a daily decline of 1.00%. New York futures gold also dropped over 1.00% during the day, currently reported at $4,340.00 per ounce.

  • Bitcoin Leads Cryptocurrency Market Value Back Above $3 Trillion

    On September 22, following a remarkable rebound in Bitcoin, the market value of digital assets returned to over $3 trillion for the first time since January. However, traders have flocked to leverage trading in perpetual futures, increasing the risk of rapid price fluctuations. According to CoinGecko data, the cryptocurrency market value has increased by over $740 billion since the U.S. Treasury announced last month that it would increase the repurchase of long-term bonds. Leverage bets have also surged. Coinglass data shows that the open interest in various token perpetual futures has risen to nearly $160 billion, the highest level since late October of last year.

  • First Tokenized Stock Trading Venues May Emerge Next Quarter

    On September 22, Taylor Lindman, Chief Legal Counsel of the SEC's Crypto Special Working Group, stated in an interview that under the SEC's five-year "Innovation Exemption" framework, the first compliant tokenized stock trading venues could gradually take shape as early as next quarter. This exemption has officially come into effect, allowing qualified platforms to conduct tokenized trading of U.S. stocks on public blockchains through licensed automated market makers (AMMs) and liquidity pools. Institutions planning to enter this space are required to issue operational notices and report to the SEC within one business day after publication. These public notices will also serve as important signals for the market to assess which companies are entering this sector. Lindman anticipates that there will be some delay in companies submitting relevant notices, likely falling within the next quarter. SEC Commissioner Hester Peirce and Lindman both emphasized that this model "leans more towards on-chain finance rather than true DeFi," as each trading platform has a clear operating entity responsible for compliance, rather than being completely decentralized peer-to-peer finance.