# yVault: First depositor can break minting of shares

First depositor mints 1 share then donates assets to the strategy to inflate share price, causing later depositors to receive zero shares and lose funds.

- Payout: Audit contest
- Severity: high
- Program: JPEG'd
- Credited: hickuphh3
- Disclosed: 2022-06-10
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2022-04-jpegd-findings/issues/12
- Library page: https://bugbountylibrary.com/r/c4%3A2022-04-jpegd%3AH-01
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:share-inflation

**Target:** yVault ERC4626-style share vault with Convex strategy
**Root cause:** Share price is derived from total assets/total supply; a direct donation to the strategy inflates assets without minting shares, so subsequent deposits round down to zero shares.
**Steps:**
1. Attacker calls `yVault.deposit(1)` to mint 1 share.
2. Attacker transfers a large amount of underlying token directly to `StrategyPUSDConvex`, inflating assets per share.
3. Victim calls `yVault.deposit(depositAmount)`; shares computed as deposit*tsupply/totalAssets rounds to 0.
4. Attacker calls `withdrawAll()` and receives victim's deposit plus own funds.
**How found:** Recognized the known Yearn/TOB-YEARN-003 first-depositor donation pattern and applied it to yVault's share math, confirming with a Foundry/Hardhat test.
**Exploitation:** Attacker needs only 1 wei plus capital to donate to the strategy; the donation raises share price so victim deposits mint zero shares, and attacker redeems the sole share for both deposits.
**Insight:** Any vault computing shares from live totalAssets is vulnerable to donation-based share inflation; check whether direct token transfers to the vault or its strategy move the share price without minting, and test the 1-wei-then-donate sequence.
