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

  • BTC Falls Below $84,000

    Market data shows that BTC has fallen below $84,000, currently priced at $83,971.46, with a 24-hour decline of 2.46%. The market is experiencing significant volatility, so please ensure proper risk management.

  • BTC Falls Below $85,000

    Market data shows that BTC has fallen below $85,000, currently priced at $84,999.01, with a 24-hour decline of 1.31%. The market is experiencing significant volatility, so please ensure proper risk management.

  • 10-Year U.S. Treasury Yield Surpasses 5% Again

    On September 23, U.S. Treasury yields rose further; the yield on the 10-year Treasury bond increased by 5.81 basis points to 5.025%.

  • Dollar Index Breaks Through 101 Level

    On September 23, the Dollar Index (DXY) rose to 101, marking its first time reaching this level since July 30, with an intraday increase of 0.47%.

  • MoonPay Plans to Acquire North Capital in Over $60 Million All-Stock Deal

    Cryptocurrency payment company MoonPay has announced plans to acquire private market investment platform North Capital in an all-stock deal valued at over $60 million. North Capital will become a wholly-owned subsidiary of MoonPay, pending regulatory approval. Headquartered in Salt Lake City, Utah, North Capital has a cumulative trading volume of approximately $9 billion in both primary and secondary markets, and its affiliated entities hold multiple qualifications, including SEC-registered broker-dealer, trading, transfer, and investment advisory.

  • NYSE and Blockchain.com Explore Tokenized US Stock Trading

    According to market news, the New York Stock Exchange (NYSE) and Blockchain.com are exploring the launch of a crypto version of US-listed stocks, which would provide tokenized stock trading in the form of blockchain.

  • Galaxy Incorporates $100 Million sUSDS into Company Treasury and Institutional Trading Collateral

    On September 23, Galaxy Digital has incorporated $100 million of Sky Protocol's sUSDS into its company treasury using its own balance sheet funds, while also approving sUSDS as collateral for its institutional trading business. The average loan size for this business is approximately $1.4 billion. Additionally, Galaxy has acquired an undisclosed amount of SKY tokens. This collaboration further deepens the partnership between Galaxy and Sky in the lending business.

  • Spot Gold Falls Below $4,300 per Ounce

    Spot gold has fallen below $4,300 per ounce, with a daily decline of 1.35%.

  • Kalshi Plans to Launch Perpetual Stock Futures Products Without Expiration Dates

    On September 23, according to the Federal Register, KalshiEX LLC (Kalshi) submitted a rule change application (File No. SR-KALSHIEX-2026-02) to the SEC on September 18, 2026, proposing to add Chapter 14 to its rulebook, which would allow the listing of "Perpetual Security Futures Products" (Perpetual SFPs) with no predetermined expiration date, based on individual stocks. This product utilizes a daily funding rate mechanism to encourage the futures price to converge with the spot price of the underlying stock; both long and short positions will pay each other funding fees based on the daily settlement price differences, with all positions cleared by Kalshi's clearing entity, Kalshi Klear LLC. Regarding listing requirements, the underlying securities must meet strict criteria, including a market capitalization of at least $100 billion, an average daily trading volume (ADTV) of no less than $450 million over the past six months, and over 20 million deliverable shares; customer margin requirements are set at 15.5% of the position's market value, exceeding the statutory minimum standard of 15%. This rule change is expected to take effect on November 2, 2026, pending approval from the CFTC.

  • BTC Falls Below $86,000

    Market data shows that BTC has fallen below $86,000, currently priced at $85,948.04, with a 24-hour decline of 0.1%. The market is experiencing significant volatility, so please ensure proper risk management.