# the first depositor to a pool can drain all users

First depositor mints 1 wei of shares, donates large attribution value, causing next depositor's shares to round to zero and funds stolen.

- Payout: Audit contest
- Severity: high
- Program: InsureDAO
- Found by: danb
- Disclosed: 2022-03-15
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-01-insure-findings/issues/263
- Library page: https://bugbountylibrary.com/r/c4%3A2022-01-insure%3AH-06
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:share-inflation

**Target:** PoolTemplate.sol deposit/share-minting logic
**Root cause:** Share minting uses (_value * _supply) / _originalLiquidity with no minimum-liquidity lock or dead shares; when supply is tiny and liquidity inflated via transferAttribution, new deposits round down to zero shares.
**Steps:**
1. Attacker is first depositor, deposits `_amount == 1` so total liquidity/supply = 1.
2. Attacker joins another pool to earn attributions, then calls `transferAttribution` to move ~1,000,000 USD of attributions into the target pool, inflating `_originalLiquidity`.
3. Victim deposits 500,000 USD; minted shares = `(500000 * 1) / 1000000 = 0`, victim pays but receives zero shares.
4. Attacker holds all shares and withdraws, capturing victim's 500,000 USD.
**How found:** Code reading of share-minting formula at PoolTemplate.sol#L807/L803; recognized classic first-depositor rounding/inflation attack when initial supply is minimal.
**Exploitation:** Attacker seeds pool with 1 wei, donates large attribution value via transferAttribution to inflate liquidity, victim deposit rounds to zero shares, attacker withdraws all pool funds.
**Insight:** On vault/pool contracts, check whether the first deposit can set a tiny supply and whether external value can be injected (donations, transfers) to inflate the denominator before a victim deposit rounds to zero shares.
