Yearn Finance Hack

TOTAL LOST $11.0M
High Flashloan Price Oracle Attack / Flash Loan Attack ethereum

Summarize with AI

Affected Chain ethereum Incident surface
Recovered $1.7M 15.5% returned
All-Time Rank #293 By amount stolen
Auditors 1 Prior security audit

Incident Overview

An attacker exploited dYdX, Aave v2, Compound, and Curve in a complex flash loan attack, resulting in a significant manipulation of funds.

The attacker initiated the exploit by flash loaning 116k ETH from dYdX and 99k ETH from Aave v2. They then borrowed 134M USDC and 129M DAI using the loaned ETH as collateral on Compound. The attacker added these funds to the 3crv Curve pool and withdrew 165M USDT.

This process was repeated five times, each time depositing less DAI to the yDAI vault and withdrawing less DAI from it. In the final iteration, the attacker withdrew 39M DAI and 134M USDC instead of USDT. The attacker then repaid the debts on Compound and the flash loans on dYdX and Aave v2.

The attacker's transactions:

https://etherscan.io/tx/0x59faab5a…0da98b

https://etherscan.io/tx/0xf6022012…b30779

Incident Report

Protocol / Project Yearn Finance
Date of Incident
Affected Chain(s) ethereum
Attack Technique Flashloan Price Oracle Attack / Flash Loan Attack
Classification Ecosystem / Yield Aggregator
Primary Source View Post-Mortem

Protocol Information

Protocol Type Yield Aggregator
Affected Token YFI
Smart Contract Language Solidity
Official Website yearn.finance/
Protocol Twitter/X @iearnfinance
Team Anonymous
Source Code Unverified

Market Context at Time of Hack

Token Categories
DeFi DAO Ethereum Ecosystem Yield Farming Yield Aggregator Yearn Partnerships Three Arrows Capital Portfolio Polychain Capital Portfolio

What the Attacker Needed to Succeed

Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.

Technical Knowledge Deep understanding of flashloan price oracle attack / flash loan attack and Solidity and EVM internals
Capital Required Flash loan capital (borrowed atomically, zero upfront cost)
On-Chain Access Ability to interact with ethereum smart contracts and deploy a custom exploit contract
Protocol Analysis Identification of the exploitable vulnerability in Yearn Finance's contract logic - root cause: ecosystem / yield aggregator
Execution Speed Precise transaction ordering and timing to exploit the vulnerability within a single atomic block
Obfuscation Plan A strategy to launder and move stolen funds - typically through mixers, cross-chain bridges, or decentralized DEX swaps to resist tracing

What Auditors Should Check

Could this have been caught in audit? Yes — skilled auditors routinely flag Flashloan Price Oracle Attack / Flash Loan Attack vulnerabilities in code review
Audited by Audit Report 1 — still lost $11.0M. Prior audits don't guarantee safety, especially after post-audit code changes.

If you're auditing a protocol with similar architecture to Yearn Finance, these are the critical security checks that could have prevented this incident (February 2021).

  • Verify all logic paths related to Flashloan Price Oracle Attack / Flash Loan Attack are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
  • Audit oracle price feeds for manipulation risks - ensure time-weighted average prices (TWAPs) or multi-source aggregators are used, not spot prices
  • Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs

Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.

Free Trial

Funds Recovery

15.5%

Recovered

$1.7M

Net Loss

9295000

Security Audit History

Related Attack Classes

The technique used in this hack maps to these vulnerability classes in our security curriculum:

See all Flash Loans Attacks examples →

Proof-of-Concept Exploits

1 PoC available
poc-exploits - yearn finance

Sources & References

Learn to Prevent the Next Yearn Finance

The Yearn Finance hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.

Recreate exploit patterns safely Free Trial