# First depositor share inflation

Empty-pool share minting without dead shares or virtual offset, and totalAssets inflatable by direct transfer

_Area: DeFi accounting and math bugs. Seen in 57 disclosed reports; latest 2026-08-20. Updated 2026-10-23._

## How it works

A vault prices shares as `supply / totalAssets`. When the pool is empty, the first deposit mints 1:1, so an attacker seeds a tiny amount, then raises `totalAssets` without minting shares (direct transfer, donation, or deposit-on-behalf). Supply stays tiny while assets grow, so the next depositor's shares round down — often to zero — and their assets accrue to the attacker. The broken assumption: `totalAssets` only moves through paths that mint or burn shares in step. Any balance outsiders can raise directly breaks that invariant.

## Where it shows up

- `convertToShares`/`convertToAssets` using `mulDivDown(supply, totalAssets())` with no virtual shares/offset and no dead-share seeding [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)
- `totalAssets()` reading `token.balanceOf(vault)` or an external strategy/reward-pool balance anyone can credit [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)
- First-mint branch minting 1:1 with no minimum deposit and no locked initial shares [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)
- Initial shares minted to `msg.sender`/deployer instead of a dead address, so they can be withdrawn [E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2.md)
- Minted share amount not required to be non-zero; zero-share mint returns silently instead of reverting [E4](https://bugbountylibrary.com/r/sherlock%3A2025-07-allbridge-core-yield%3AM-1.md)
- Share math computed after an external call that already bumped `totalAssets` [E8](https://bugbountylibrary.com/r/c4%3A2025-10-hybra-finance%3AH-01.md)
- "First deposit" guards keyed off a live token balance rather than a stored flag [E6](https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-11.md)
- Vault holding assets while `totalSupply()==0`, so the first depositor mints 1:1 against pre-existing balance [E7](https://bugbountylibrary.com/r/dhl%3A20260420-thetanutsvaultsharerounding.md)

## How to review

Check the invariant: after any external action, `totalAssets` must only change through paths that mint or burn shares proportionally. Concretely: does the empty-pool path lock dead shares or use virtual shares/offset (the OZ ERC4626 standard fix)? Can a direct transfer or deposit-on-behalf move the denominator without touching supply? Is a zero-share mint rejected? Are initial shares sent to a dead address? Is share math done before any state-changing transfer? For first-supply guards, is the flag stored per-reserve rather than derived from balance? [E6](https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-11.md)

## Variants seen

- ERC4626-style vault: tiny seed plus donation inflates price, next depositor gets 0 shares [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)
- Vault whose `totalAssets` is an external strategy balance, inflated by direct transfer [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)
- Initial shares minted to `msg.sender` instead of dead address, enabling inflation [E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2.md)
- AMM LP: tiny mint then donate reserves, later LP rounds to zero [E3](https://bugbountylibrary.com/r/cantina%3Aterm_max_december2024%3A3.1.2.md)
- Silent zero-share mint plus auto-credited donations inflating virtual total [E4](https://bugbountylibrary.com/r/sherlock%3A2025-07-allbridge-core-yield%3AM-1.md)
- Share math after external deposit call dilutes depositor [E8](https://bugbountylibrary.com/r/c4%3A2025-10-hybra-finance%3AH-01.md)
- Dust transfer flips a balance-derived first-supply check [E6](https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-11.md)
- Pre-existing assets with zero supply: first depositor mints 1:1 and redeems the whole balance [E7](https://bugbountylibrary.com/r/dhl%3A20260420-thetanutsvaultsharerounding.md)

## Impact and severity

Later depositors lose funds or receive zero shares; severity is high where loss is direct theft of deposits [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md)[E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2.md)[E3](https://bugbountylibrary.com/r/cantina%3Aterm_max_december2024%3A3.1.2.md)[E4](https://bugbountylibrary.com/r/sherlock%3A2025-07-allbridge-core-yield%3AM-1.md)[E5](https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md)[E7](https://bugbountylibrary.com/r/dhl%3A20260420-thetanutsvaultsharerounding.md). It worsens when no minimum first deposit exists and `totalAssets` is donation-inflatable, since the attack needs only a tiny seed plus a transfer. The guard-bypass variant [E6](https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-11.md) is lower severity: it skips first-supply checks (minimum deposit, oracle, collateral bit) rather than stealing funds directly, though it can enable an unsafe first supply.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2025-05-yearn-ybold%3AH-1.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2.md
- E3: https://bugbountylibrary.com/r/cantina%3Aterm_max_december2024%3A3.1.2.md
- E4: https://bugbountylibrary.com/r/sherlock%3A2025-07-allbridge-core-yield%3AM-1.md
- E5: https://bugbountylibrary.com/r/c4%3A2024-05-bakerfi%3AH-02.md
- E6: https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-11.md
- E7: https://bugbountylibrary.com/r/dhl%3A20260420-thetanutsvaultsharerounding.md
- E8: https://bugbountylibrary.com/r/c4%3A2025-10-hybra-finance%3AH-01.md
