Skip to content

Conversation

@carlospolop
Copy link
Collaborator

🤖 Automated Content Update

This PR was automatically generated by the HackTricks News Bot based on a technical blog post.

📝 Source Information

  • Blog URL: https://research.checkpoint.com/2025/16-wei/
  • Blog Title: The $9M yETH Exploit: How 16 Wei Became Infinite Tokens
  • Suggested Section: Blockchain & Crypto -> New page such as "DeFi AMM Accounting Bugs & Virtual Balance Cache Exploitation" (covering cached virtual balances on supply==0, rounding-residual state poisoning, and flash-loan-based manipulation)

🎯 Content Summary

This blog post dissects a critical accounting vulnerability in Yearn Finance’s yETH pool on Ethereum that allowed an attacker to steal ~9M USD by minting ~235 septillion yETH LP tokens in exchange for only 16 wei (~4.5×10⁻¹⁷ USD). The bug arises from cached virtual-balance storage (packed_vbs[]) not being reset when the pool’s total LP token supply becomes zero, enabling a “phantom liquidity” condition and catastrophic LP over-minting.


Protocol Architecture an...

🔧 Technical Details

Trick 1 – Exploiting Cached Virtual Balances That Aren’t Reset on supply == 0
The core technique is to abuse AMM implementations that cache derived state (such as virtual balances) for gas savings but fail to reset these caches when total LP supply reaches zero. In such designs, each asset’s virtual balance is computed as vb_i = balance_i × rate_i / PRECISION and stored in an array like packed_vbs[]. When liquidity is removed, the code decrements these cached values proportionally. If the implementation never explicitly sets packed_vbs[i] = 0 when all LP tokens are burned, a state can arise where supply == 0 yet packed_vbs[] > 0. Any logic that interprets prev_supply == 0 as a pristine “first deposit” and reuses cached values instead of recomputing from actual balances is then exploitable: a tiny dust deposit can trigger minting of LP tokens calibrated against historic ...

🤖 Agent Actions

Summary:

  • Added a dedicated “DeFi AMM Accounting Bugs & Virtual Balance Cache Exploitation” page detailing how Yearn’s yETH weighted stableswap cached virtual balances in packed_vbs[], how rounding residues plus a missing reset on supply == 0 enabled the 16-wei/235-septillion LP over-mint, the flash-loan driven poisoning workflow, generalized exploitation preconditions, and concrete engineering/monitoring defenses.
  • Updated the Blockchain & Crypto-Currencies index to reference the new page alongside the existing Uniswap v4 hook exploitation note so readers can quickly find guidance on both rounding-threshold and cached-balance attack classes.

Files Touched:

  1. src/blockchain/blockchain-and-crypto-currencies/defi-amm-virtual-balance-cache-exploitation.md
  2. src/blockchain/blockchain-and-crypto-currencies/README.md

This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.

@carlospolop
Copy link
Collaborator Author

🔗 Additional Context

Original Blog Post: https://research.checkpoint.com/2025/16-wei/

Content Categories: Based on the analysis, this content was categorized under "Blockchain & Crypto -> New page such as "DeFi AMM Accounting Bugs & Virtual Balance Cache Exploitation" (covering cached virtual balances on supply==0, rounding-residual state poisoning, and flash-loan-based manipulation)".

Repository Maintenance:

  • MD Files Formatting: 915 files processed

Review Notes:

  • This content was automatically processed and may require human review for accuracy
  • Check that the placement within the repository structure is appropriate
  • Verify that all technical details are correct and up-to-date
  • All .md files have been checked for proper formatting (headers, includes, etc.)

Bot Version: HackTricks News Bot v1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants