# Attacker can manipulate the pricePerShare to profit from future users' deposits

First depositor inflates pricePerShare via direct LINK transfer, causing later depositors' shares to round to zero and lose deposits.

- Payout: Contest reward
- Severity: high
- Program: Mycelium
- Credited: Ruhum
- Disclosed: 2022-10-03
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2022-10-mycelium-judging/tree/main/001-H
- Library page: https://bugbountylibrary.com/r/sherlock%3A2022-10-mycelium%3AH-1
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:precision-loss vuln:share-inflation

**Target:** ERC4626-style Vault deposit/convertToShares
**Root cause:** convertToShares uses mulDivDown against totalShares/totalSupply, so a large token balance with tiny share supply rounds new depositors' shares to zero; no minimum initial shares or dead-share reserve.
**Steps:**
1. Attacker is first depositor: `deposit(1 wei LINK)` mints `STARTING_SHARES_PER_LINK` shares.
2. Attacker transfers `STARTING_SHARES_PER_LINK - 1` LINK directly to vault, inflating pricePerShare to ~1.
3. Attacker `withdraw()`s `STARTING_SHARES_PER_LINK - 1` shares.
4. Attacker transfers `1e22` LINK directly to vault, inflating pricePerShare to ~1e22.
5. Victim `deposit(9999e18)` computes `9999e18 * 1 / 10000e18 = 0` shares, losing entire deposit.
**How found:** Code review of convertToShares rounding down combined with donation-based share price inflation; classic first-depositor attack pattern.
**Exploitation:** Attacker seeds vault with 1 wei, donates LINK to inflate share price, then donates 1e22 LINK so subsequent deposits round to zero shares; attacker redeems inflated shares to capture victim funds.
**Insight:** Check ERC4626-style vaults for missing dead-share/minimum-deposit protection: any direct token transfer inflates pricePerShare, so test whether a 1-wei first deposit plus donation zeroes out the next depositor's shares.
