# bZx iYFI share inflation drains iETH and iWBTC pools

bZx iToken share-price inflation via donation after emptying pool let attacker borrow all iETH and iWBTC and withdraw collateral, netting ~$208k.

- Payout: Real-world hack
- Severity: high
- Program: bZxProtocol
- Analysis by: DeFiHackLabs
- Disclosed: 2023-12-02
- Write-up quality: 7/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2023-12/bZx_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20231202-bzx
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity vuln:accounting-error vuln:flash-loan vuln:oracle-manipulation vuln:share-inflation

**Target:** iToken lending pools (iYFI/iETH/iWBTC) on bZx
**Root cause:** iToken mint/burn share accounting is manipulable: burning the last shares empties totalSupply, then a tiny mint plus a large direct donation inflates the per-share value, and bZx collateral valuation/rounding lets the inflated shares back oversized borrows.
**Steps:**
1. Flash-swap YFI from YFI/WETH Uniswap V2 pair via `swap(yfiFlashAmount,0,this,abi.encodePacked(uint8(48)))`.
2. In callback, `iYFI.burn(originalAttackContract, 5)` to empty the iYFI pool (totalSupply→0, underlying→0).
3. `iYFI.mint(this, 5)` — deposit 5 wei YFI for 5 wei shares.
4. `YFI.transfer(iYFI, balance)` — donate large YFI to inflate share value.
5. `iYFI.approve(iETH,...)`; `iETH.borrow(0, WETH.balanceOf(iETH), 0, 5, iYFI, this, this, '')` using inflated iYFI as collateral; then `bzX.withdrawCollateral(loanId, this, 5)`.
6. Repeat against iWBTC, swap WBTC→WETH via Sushi.
7. `iYFI.burn(this, iYFIAmount)` to recover underlying YFI, swap WETH→YFI, repay flash loan.
**Exploitation:** Attacker flash-borrowed YFI, collapsed iYFI totalSupply to zero by burning the last shares, re-minted minimal shares, then donated YFI directly to the pool to inflate share price. The inflated iYFI was posted as collateral to borrow the entire WETH balance of iETH and WBTC balance of iWBTC, then collateral was withdrawn (rounding let it pass), and proceeds swapped to repay the flash loan.
**Escalation:** Same inflated-collateral trick reused across multiple iToken pools (iETH, iWBTC) to drain each.
**Insight:** When a lending pool's share token can reach totalSupply==0, a tiny mint followed by a direct token donation sets an arbitrary share price; check whether collateral valuation and withdrawCollateral rounding accept those inflated shares for max borrow.
