Decrypting The 197 Million Euler Finance Exploit
A logical flaw in Euler Finance's donateToReserve function let an attacker burn e-DAI tokens while leaving d-DAI debt untouched, creating unbacked debt. Using flash loans and two accounts, the attacker repeatedly liquidated and borrowed to drain roughly $197 million.
Dissecting Euler Finance Examining the $197 Million Fraud Behind the Flash Loan Attack
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the donateToReserve function burned e-DAI without reducing the matching d-DAI debt, so the account's debt became unbacked and could be liquidated for profit.
Impact
The attacker could drain the protocol's reserves, with the incident resulting in a reported $197 million loss.
What the attacker needed
Flash loan liquidity available; vulnerable donateToReserve function
The fix
The donateToReserves function should enforce ongoing over-collateralisation and suspend transactions when that condition is not met.
How it was found
- Take a large DAI flash loan and open two accounts, one as borrower and one as liquidator.
- Use part of the loan to mint e-DAI and d-DAI through the borrower account.
- Refund part of the DAI so the value of d-DAI tokens drops.
- Mint more e-DAI and d-DAI, then exploit donateToReserve so e-DAI is burned but d-DAI debt remains.
- Have the liquidator account liquidate the debt and borrow against it for a large profit.
- Repay the flash loan and repeat the cycle until the reserves are drained.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Euler Finance is a lending service built on smart contracts, where people deposit and borrow digital money. A mistake in one function let an attacker make the system think debt had been repaid when it had not, so they could take far more money out than they put in. They repeated this until the service's funds were gone.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.