Last Updated: December 4, 2025 | Word Count: ~6,200 | Reading Time: 25 minutes


Quick Facts

Specification Value
Project Name Yearn Finance
Affected Product yETH StableSwap Pool
Exploit Date December 2, 2025
Total Loss $9 Million
Recovered ~$2.4 Million
Net Loss ~$6.6 Million
Attack Type Infinite Mint via Cache Desync
This Was Yearn’s 3rd Major Exploit
Status Contracts Paused, Post-Mortem Ongoing

Table of Contents

  1. Executive Summary
  2. What Happened
  3. Technical Deep Dive
  4. The Attack Step-by-Step
  5. Who Was Affected
  6. Yearn’s Response
  7. History of Yearn Exploits
  8. Lessons for DeFi
  9. Frequently Asked Questions
  10. Sources & References

Executive Summary

On December 2, 2025, Yearn Finance—one of DeFi’s oldest and most respected protocols—suffered its third major exploit since 2021. An attacker exploited a subtle bug in a legacy yETH StableSwap pool contract, minting an astronomical 235 septillion yETH tokens from a deposit of just 16 wei (worth a fraction of a cent).

The attacker then swapped these fabricated tokens for real assets, draining approximately $9 million from the pool before laundering a portion through Tornado Cash. Yearn’s security team responded quickly, pausing contracts and coordinating with partners to recover approximately $2.4 million, reducing net losses to around $6.6 million.

This incident highlights a critical challenge facing mature DeFi protocols: legacy code. The exploited contract was an older, custom StableSwap implementation that predated current best practices. While Yearn’s modern V2/V3 vaults remained secure, this forgotten pool—still generating fees and holding user funds—contained a fatal flaw that went undetected for years.

The Yearn yETH exploit serves as a stark reminder that in DeFi, old code doesn’t die—it just waits to be exploited.


What Happened

The yETH Pool

The exploited contract was Yearn’s yETH StableSwap pool, a specialized liquidity pool designed for trading between Ethereum liquid staking derivatives (LSTs/LSDs) like:

  • wstETH (Wrapped Lido Staked ETH)
  • rETH (Rocket Pool ETH)
  • cbETH (Coinbase Staked ETH)
  • yETH (Yearn’s own staked ETH derivative)

These tokens are all meant to be roughly pegged to the value of ETH, so a StableSwap-style AMM allows efficient swaps with minimal slippage—similar to how Curve handles stablecoin swaps.

The Vulnerability

The pool used a virtual balance cache system to track liquidity and save gas costs. This optimization stored “packed” balance values in storage that were supposed to mirror actual pool balances.

The fatal flaw: When liquidity was completely withdrawn and the pool’s supply dropped to zero, the main supply counter correctly reset, but the cached virtual balances were not completely cleared. This created a desynchronization between what the contract thought it had and what it actually had.

The Exploit Window

The attacker identified that:

  1. If they could manipulate the cached balances
  2. Then empty the pool completely
  3. Then make a “first deposit” into the “empty” pool
  4. The contract would calculate token minting based on the inflated cache rather than the actual deposit

This allowed minting essentially infinite tokens from a near-zero deposit.


Technical Deep Dive

The Virtual Balance Cache Bug

Yearn’s yETH pool implemented a common gas optimization pattern: instead of reading from storage on every operation, it maintained a packed virtual balance array (`packed_vbs[]` or similar) that cached token balances.


Normal Operation:
- User deposits → Cache updated → Tokens minted based on deposit/cache ratio
- User withdraws → Cache updated → Tokens burned

The Bug:
- All users withdraw → Supply = 0, but cache retains phantom balances
- New "first deposit" → Contract treats as fresh pool seeding
- Minting calculation uses inflated cache values
- Result: Massive token minting from tiny deposit

Why This Wasn’t Caught

Several factors contributed to this bug remaining undetected:

  1. Edge Case Scenario: The bug only manifested when the pool was completely emptied—a rare occurrence for active pools
  1. Legacy Code: The contract predated current auditing standards and security practices
  1. Gas Optimization Complexity: The packed storage pattern was complex and the desync scenario wasn’t obvious
  1. Low Priority: As older code that “worked,” it wasn’t prioritized for re-auditing
  1. No Active Monitoring: The specific state transition wasn’t monitored for anomalies

The Math of Infinite Minting

When the attacker deposited 16 wei into the “empty” pool:

  • Expected outcome: Mint tokens proportional to 16 wei deposit
  • Actual outcome: Contract used cached phantom balances (from previous deposits)
  • Result: Minted approximately 235 septillion (235,000,000,000,000,000,000,000,000) yETH tokens

This astronomical number, when swapped against the pool’s real assets, drained everything available.


The Attack Step-by-Step

Phase 1: Cache Pollution

The attacker began by manipulating the virtual balance cache:

  1. Flash loan acquisition: Borrowed large amounts of LST tokens
  2. Deposit/withdraw cycles: Repeatedly deposited and withdrew
  3. Cache pollution: Each cycle left residual amounts in the cached balances
  4. Accumulated phantom balances: Built up significant cached values

Phase 2: Pool Emptying

Next, the attacker ensured the pool was completely empty:

  1. Withdrew all available liquidity (possibly through additional manipulation)
  2. Pool supply counter reset to zero
  3. Cached balances remained inflated (the bug)

Phase 3: The Infinite Mint

With the trap set:

  1. Deposited 16 wei across pool tokens
  2. Contract treated this as “first deposit” to an empty pool
  3. Minting calculation used inflated cache
  4. 235 septillion yETH minted to attacker

Phase 4: Value Extraction

Finally, the attacker converted fake tokens to real value:

  1. Swapped infinite yETH against pool’s real LST assets
  2. Drained underlying wstETH, rETH, cbETH
  3. Converted to ETH on secondary markets
  4. Laundered ~1,000 ETH (~$3M) through Tornado Cash
  5. Retained remaining assets in attacker wallet

Attack Timeline

Time Action
T-60 min Flash loan preparation
T-30 min Cache pollution begins
T-5 min Pool emptying
T-0 16 wei deposit, infinite mint
T+1 min Asset swaps begin
T+10 min Tornado Cash transfers start
T+30 min Yearn detects anomaly
T+45 min Contracts paused

Who Was Affected

Direct Victims

Liquidity Providers (LPs) in the yETH StableSwap pool suffered direct losses:

  • LP tokens became worthless as underlying assets were drained
  • Unable to withdraw deposited assets
  • Total LP losses: ~$9 million (before recovery)

Indirect Impact

Yearn Token Holders (YFI):

  • Reputational damage to protocol
  • Short-term price impact
  • Governance discussions about security

DeFi Ecosystem:

  • Questions about legacy contract risks industry-wide
  • Renewed focus on contract deprecation policies
  • Insurance protocol implications

What Was NOT Affected

Importantly, Yearn’s core products remained secure:

  • V2 Vaults: Unaffected
  • V3 Vaults: Unaffected
  • Main TVL: Unaffected
  • Most user funds: Safe

The exploit was isolated to the legacy yETH pool, not Yearn’s primary infrastructure.


Yearn’s Response

Immediate Actions (Within Hours)

  1. Detection: On-chain monitoring detected anomalous minting
  2. Contract Pause: Affected contracts paused to prevent further losses
  3. Frontend Blocking: UI updated to prevent new deposits
  4. Communication: Public announcement via Twitter and Discord

Recovery Efforts

Yearn coordinated with ecosystem partners to recover funds:

  • Recovered: Approximately $2.4 million worth of assets
  • Method: Coordinated with exchanges and other protocols
  • Frozen: Some attacker assets identified and flagged

Post-Mortem Process

Yearn initiated a comprehensive review:

  1. Root Cause Analysis: Full technical breakdown of the bug
  2. Code Audit: Review of all legacy contracts
  3. Deprecation Plan: Roadmap to sunset old code
  4. Monitoring Enhancement: New alerting for similar patterns

User Remediation

Yearn’s governance is discussing:

  • Treasury funds for affected LPs
  • Insurance claim processes
  • Partial vs. full compensation
  • Timeline for decisions

Official Statement

Yearn acknowledged the incident publicly, taking responsibility for the legacy code and committing to:

> “We are conducting a full review of all legacy contracts and will be accelerating our deprecation timeline for older systems. Affected users will be supported through our governance process.”


History of Yearn Exploits

Yearn REKT I: February 2021

The DAI Vault Flash Loan Attack

Detail Value
Date February 4-5, 2021
Loss $11 million
Attack Type Flash loan + oracle manipulation
Affected DAI vault strategies

What Happened: An attacker used flash loans to manipulate lending rates and oracle prices, draining funds from Yearn’s DAI vault strategies. This was one of the largest DeFi exploits of early 2021.

Response: Yearn covered losses from treasury and implemented improved strategy auditing.

Yearn REKT II: April 2023

The Treasury Misconfiguration

Detail Value
Date April 2023
Loss ~$1.4 million
Attack Type Operational error
Affected Treasury operations

What Happened: During a routine treasury conversion, a misconfigured multisig operation caused Yearn to suffer a loss of approximately 63% of a specific treasury pool. This was internal error rather than external attack.

Response: Improved operational procedures and multisig requirements.

Yearn REKT III: December 2025 (Current)

The yETH Infinite Mint

Detail Value
Date December 2, 2025
Loss $9 million (~$6.6M net)
Attack Type Logic bug / infinite mint
Affected yETH StableSwap pool

What Happened: Legacy code with a virtual balance cache bug allowed an attacker to mint infinite tokens from a 16 wei deposit.

Pattern Analysis

Incident Year Loss Root Cause
REKT I 2021 $11M Flash loan / oracle
REKT II 2023 $1.4M Operational error
REKT III 2025 $9M Legacy code bug
Total $21.4M

The pattern shows: Yearn’s vulnerabilities have shifted from external attack vectors (flash loans) to internal issues (operations and legacy code). This suggests their newer systems are more robust, but technical debt remains dangerous.


Lessons for DeFi

1. Legacy Code Is a Liability

The most important lesson: old code doesn’t get safer with age—it gets more dangerous.

  • Smart contracts can’t be updated in place
  • Deployed code remains vulnerable forever
  • Gas optimizations from years ago may have unknown bugs
  • “Working” doesn’t mean “secure”

Action: Protocols must actively deprecate and migrate away from legacy systems.

2. Edge Cases Are Attack Vectors

The yETH bug only manifested under specific conditions (pool completely empty). Attackers specifically hunt for edge cases.

Action: Security reviews must consider all possible state transitions, especially rare ones.

3. Gas Optimizations Have Hidden Costs

The virtual balance cache was designed to save gas. It also introduced fatal complexity.

Action: Trade-off analysis between optimization and security must be explicit.

4. Monitoring Must Cover Legacy Systems

Modern systems often have better monitoring than older ones. Attackers know this.

Action: Legacy contracts need equal or greater monitoring than new code.

5. DeFi Needs Deprecation Policies

Unlike traditional software, smart contracts can’t be easily deprecated. But protocols must try.

Action: Implement migration incentives, sunset timelines, and clear communication.

6. Flash Loans Enable Everything

Once again, flash loans provided the capital for an exploit that would otherwise be impractical.

Action: Consider flash loan scenarios in all security reviews.

7. Even Blue Chips Get Hacked

Yearn is one of DeFi’s most respected protocols with experienced security teams. They still got exploited—three times.

Action: No protocol is “too big to hack.” Users must diversify and use risk management.


Frequently Asked Questions

What is Yearn Finance?

Yearn Finance is a decentralized finance (DeFi) protocol that provides yield optimization strategies. Users deposit assets into Yearn “vaults,” and the protocol automatically allocates those assets to the highest-yielding opportunities across DeFi. Founded by Andre Cronje in 2020, Yearn became one of DeFi’s “blue chip” protocols.

What happened in the December 2025 Yearn hack?

On December 2, 2025, an attacker exploited a bug in Yearn’s legacy yETH StableSwap pool. The bug involved a desynchronization between the pool’s supply counter and its cached balance values. By manipulating the cache and emptying the pool, the attacker was able to mint 235 septillion yETH tokens from just 16 wei, then drain approximately $9 million in real assets.

How much was stolen in the Yearn yETH exploit?

The attacker initially drained approximately $9 million from the yETH pool. Yearn and partners recovered about $2.4 million, bringing net losses to approximately $6.6 million.

Was my Yearn vault affected?

If you had funds in Yearn’s main V2 or V3 vaults, your funds were NOT affected. The exploit was isolated to the legacy yETH StableSwap pool. Only liquidity providers in that specific pool suffered losses.

Is this Yearn’s first hack?

No. This is Yearn’s third major exploit:

  1. February 2021: $11 million flash loan attack
  2. April 2023: $1.4 million treasury misconfiguration
  3. December 2025: $9 million yETH infinite mint

Total losses across all incidents: approximately $21.4 million.

How did the infinite mint bug work?

The yETH pool used a “virtual balance cache” to save gas. When all liquidity was withdrawn, the supply counter reset to zero, but the cached balances weren’t properly cleared. When the attacker made a tiny “first deposit” into the empty pool, the contract calculated token minting using the inflated cached values instead of the actual deposit, allowing essentially infinite minting.

Will affected users be compensated?

Yearn’s governance is currently discussing compensation options for affected liquidity providers. Options include treasury funds, insurance claims, and community proposals. Affected users should monitor Yearn’s governance forums and Discord for updates.

Is Yearn still safe to use?

Yearn’s core V2 and V3 vaults remain operational and were not affected by this exploit. However, the incident highlights risks in any DeFi protocol. Users should:

  • Understand what they’re depositing into
  • Avoid legacy/deprecated products
  • Diversify across protocols
  • Never invest more than they can afford to lose

What is Yearn doing to prevent future hacks?

Yearn has announced:

  • Full audit of all legacy contracts
  • Accelerated deprecation of old systems
  • Enhanced monitoring for anomalous patterns
  • Improved state transition testing
  • Governance discussion on security processes

How was the attacker able to use Tornado Cash?

Tornado Cash is a privacy protocol that allows users to break the on-chain link between wallet addresses. Despite sanctions and restrictions in some jurisdictions, it remains technically operational. The attacker used it to launder approximately $3 million (1,000 ETH) of the stolen funds, making those assets difficult to trace.


Sources & References

  1. Rekt News – “Yearn – REKT III” (December 2, 2025) – rekt.news
  1. CoinDesk – “Bitcoin, Ether, XRP Slide as December Begins with Yearn Attack” (December 1, 2025) – coindesk.com
  1. DL News – “Yearn Finance looted for $9M after attacker minted trillions” – dlnews.com
  1. Unchained Crypto – “Yearn Recovers $2.4M Stolen in $9M Exploit” – unchainedcrypto.com
  1. Checkpoint Research – “16 Wei: Technical Analysis of Yearn Exploit” – research.checkpoint.com
  1. Infosecurity Magazine – “Yearn Finance yETH Pool Exploit” – infosecurity-magazine.com

Disclaimer

This article is for informational and educational purposes only. It does not constitute financial, investment, or legal advice. DeFi protocols carry significant risk, including the potential loss of all deposited funds. Always conduct your own research (DYOR).


Article by: LAB Blockchain Summit Research Team Category: DeFi Exploits | Security Incidents Tags: yearn finance, yETH, defi hack, infinite mint, smart contract exploit, december 2025


Related Articles

Similar Posts