# Enzyme Finance Price Oracle Manipulation Bugfix Review

Enzyme priced Idle tokens via NAV/totalSupply; flashloaning IdleUSDCYield drained its balance, skewing GAV so shares were bought cheap and redeemed for profit.

- Payout: $90,000
- Severity: critical
- Program: Enzyme Finance
- Credited: setuid0
- Disclosed: 2021-11-25
- Write-up quality: 7/10
- Original: https://immunefi.com/blog/bug-fix-reviews/enzyme-finance-price-oracle-manipulation-bugfix-review/
- Library page: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-enzyme-finance-price-oracle-manipulation-bugfix-review
- Tags: domain:web3 impact:funds-loss kind:bounty platform:blog platform:immunefi sev:critical tech:evm tech:solidity technique:chained technique:source-review vuln:business-logic vuln:flash-loan vuln:oracle-manipulation

**Target:** ComptrollerLib buyShares / IdlePriceFeed / IdleTokenGovernance
**Root cause:** IdlePriceFeed derived Idle token unit price from NAV/totalSupply, where NAV depends on the IdleToken contract's current backing-asset balance; Idle v5 added an internal flashloan that temporarily empties that balance, making the price manipulable within one transaction.
**Steps:**
1. Fund attacker contract with WETH.
2. Flashloan max IdleUSDCYield tokens from IdleTokenGovernance, emptying its backing balance and skewing GAV.
3. During the flashloan, swap WETH to USDC to have underlying assets for the purchase.
4. Call `buyShares()` on ComptrollerLib while GAV is depressed, minting shares at a discount.
5. Repay the flashloan.
6. Call `redeemShares()` to sell the discounted shares at true value for profit.
**How found:** Researcher traced buyShares -> calcGav -> IdlePriceFeed.tokenPrice and noticed price = NAV/totalSupply where NAV reflects the IdleToken contract's live balance; recognizing Idle v5 added internal flashloan logic (absent in v4) revealed the balance could be temporarily emptied to skew the price.
**Exploitation:** Attacker flashloans IdleUSDCYield to distort the Idle token price feed used by calcGav, buys fund shares cheaply with swapped USDC mid-flashloan, repays, then redeems shares at the restored price, extracting the difference. ~$400k was at risk.
**Insight:** When a price feed reads a derivative token's own NAV/totalSupply, check whether that token's balance can be moved within a single tx (e.g. its own flashloan feature); upgrades adding lending/flashloan logic to an already-integrated token can silently make an existing feed manipulable.
