Onchain Atlas

Harvest Finance Flash Loan Exploit

A flash-loan-funded price manipulation of Curve's Y pool let an attacker mint and redeem Harvest Finance vault shares at manipulated prices, draining roughly $24-34M in minutes.

▶ Run interactive simulation animated mechanism with editable parameters

Statusexploited
Launched2020-10-26
ChainsEthereum
MechanismsFlash loans, Automated market maker price manipulation, Vault share price oracle, Stablecoin AMM (Curve Y pool)
Official sitehttps://harvest.finance/
Project X@harvest_finance (strongly_inferred)
FoundersUnknown / not found

How it works onchain

Diagram of how Harvest Finance Flash Loan Exploit's mechanism worksOpen full-size diagram
Original diagram derived from this entry’s researched mechanism description.

Summary

Harvest Finance was an Ethereum yield aggregator, launched September 1, 2020 by an anonymous team, that auto-compounded deposits across DeFi strategies via ERC-20-denominated vaults (fUSDC, fUSDT, fDAI, etc.) and distributed a fair-launch governance token, FARM. On October 26, 2020, an attacker used a large flash loan to violently swing the balance of Curve's Y pool (USDC/USDT/DAI/tUSD), causing Harvest's vault share-price calculation — which read directly off that pool's spot balances — to be temporarily mispriced. By depositing into and withdrawing from the vaults at the top and bottom of the manipulated price swings, the attacker extracted value from other depositors in a tight, repeatable loop, draining an estimated $24-34 million from the USDC and USDT vaults within minutes. The attacker later returned roughly $2.5 million to the deployer address for reasons that were never explained.

Design (Mechanism)

Harvest's vaults minted fTokens (e.g., fUSDC) to depositors based on the vault's total underlying value divided by total fToken supply — effectively a share price. That underlying value was calculated in part by reading the instantaneous balances of Curve's Y pool, a stableswap AMM holding USDC, USDT, DAI, and tUSD. Because the Y pool's reserve ratios can be moved dramatically and near-instantly with enough capital, and because Harvest's strategy used exchange_underlying on Curve as part of its yield logic and price reference, the vault's reported share price could be pushed away from its true value within a single transaction.

The attacker exploited this directly: take a flash loan (reported near $50M in USDC from Uniswap), swap a large amount of USDT for USDC on Curve to distort the Y pool's balance and depress the calculated cost basis, deposit USDC into Harvest's vault to mint fUSDC at the artificially cheap rate, swap back on Curve to restore the pool ratio (raising the vault's share price again), then redeem the fUSDC for more USDC than was deposited. This cycle was repeated across the USDC and USDT vaults, each iteration extracting a slice of value from existing depositors' pooled funds, all funded and unwound within one atomic flash-loan transaction so the attacker never needed working capital of their own.

Outcome

The attack drained an estimated $24 million (contemporaneous press estimates) to $33.8 million (Harvest's own later figure) from the fUSDC and fUSDT vaults. FARM's token price fell roughly 60-70% within hours as depositors panicked, and Harvest's total value locked reportedly dropped by more than $500 million over the following twelve hours as users rushed to withdraw ("bank run") even from unaffected vaults. The attacker unexpectedly returned about $2.5 million to Harvest's deployer address shortly after the exploit; the remainder was not recovered. Harvest's team publicly acknowledged the bug ("We made an engineering mistake, we own up to it"), posted a bounty for information leading to fund recovery, asked major exchanges to flag the attacker's addresses, and used the DAO/treasury alongside a portion of protocol revenue to reimburse affected depositors pro-rata in the following weeks. The protocol continued operating after the incident but never regained its pre-exploit TVL or prominence, and it remains best known within DeFi history primarily for this exploit.

Why it worked

  • Deep, cheaply-borrowable capital via flash loans let the attacker temporarily control the pricing input (Curve Y pool balances) without needing pre-existing capital or taking on price risk, since the entire cycle was atomic.
  • Harvest's share-price calculation trusted a spot/instantaneous on-chain price source rather than a time-weighted or otherwise manipulation-resistant oracle, so a single large trade could distort it.
  • The exploit required no bug in access control or arithmetic — it abused legitimate contract functions in an unanticipated sequence, which made it harder to catch in a standard security audit focused on typical vulnerability classes.

Where the design broke

  • Pricing vault shares from manipulable spot AMM balances was already a known DeFi anti-pattern by late 2020 (bZx had suffered similar flash-loan price-manipulation attacks earlier that year); the vault's share-price calculation had no defense against this attack class at launch.
  • The vaults lacked deposit/withdraw friction (e.g., time locks, commit-reveal, or deposit fees) that could have made single-block manipulation unprofitable.
  • The team's fast, transparent public response limited reputational damage but could not undo the loss of depositor funds or the trust hit; TVL and FARM price never recovered to pre-hack levels.

Lessons

  • Never price shares, collateral, or liquidations directly off spot balances of an AMM pool that can be moved within a single transaction; use manipulation-resistant oracles (TWAPs, external price feeds, or multi-block confirmation).
  • Flash loans remove the capital constraint that previously made large, precise price-manipulation attacks impractical — protocols must design as if attackers have unlimited capital for the duration of one transaction.
  • A fast, transparent incident response (public acknowledgment, bounty, reimbursement effort) can preserve community goodwill but does not substitute for pre-launch defenses against known attack classes; audits should explicitly test for flash-loan-enabled oracle manipulation.

Redesign (EDITORIAL)

EDITORIAL — hypothesis, not fact. A materially safer version of Harvest's vaults could have (1) computed share price from a time-weighted average of Curve pool state over multiple blocks rather than instantaneous balances, closing the single-transaction manipulation window; (2) capped the maximum single-transaction deposit or withdrawal size relative to vault TVL, limiting how much value any one manipulated trade could extract; (3) added a short (even one-block) delay between deposit and the ability to withdraw, breaking the atomicity that made the attack risk-free; and (4) run bug bounties or formal-verification-style economic simulations specifically modeling flash-loan-funded price attacks before mainnet launch, given that this attack class was already public knowledge from earlier 2020 incidents.

Sources

  1. Slow Mist: Analysis of Harvest.Finance's Hacked Event — primary (postmortem)
  2. DeFi protocol Harvest Finance exploited, attacker drained $33.8M and then returned $2.5M | The Block — primary (news)
  3. Hackers Drain DeFi Protocol Harvest Finance of $24 Million (news)
  4. Harvest Finance: $24M Attack Triggers $570M 'Bank Run' in Latest DeFi Exploit - CoinDesk (news)
  5. Official Harvest Finance Resources | Harvest Finance Community Wiki (community wiki)
  6. FARM token - Harvest Finance docs — primary (documentation)

Related experiments

Last verified: 2026-07-27 · Spot an error? Suggest a correction