# A malicious early user/attacker can manipulate the vault's pricePerShare to take an unfair share of future users' deposits

First depositor inflates AaveV3YieldSource pricePerShare via aToken donation, causing later depositors' shares to round to near-zero and lose funds.

- Payout: Audit contest
- Severity: high
- Program: PoolTogether
- Credited: WatchPug
- Disclosed: 2022-06-23
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2022-04-pooltogether-findings/issues/44
- Library page: https://bugbountylibrary.com/r/c4%3A2022-04-pooltogether%3AH-01
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:precision-loss vuln:share-inflation

**Target:** AaveV3YieldSource.sol share accounting (_tokenToShares/_sharesToToken)
**Root cause:** _tokenToShares divides by aToken.balanceOf(address(this)) which can be inflated by direct aToken transfer, and no minimum share check exists, so rounding lets an attacker capture later deposits.
**Steps:**
1. Attacker calls `supplyTokenTo()` with `1 wei` underlying as first depositor, receiving `1 wei` shares.
2. Attacker transfers `10000e18 - 1` aToken directly to the yield source, inflating PPS to ~1.0000e22.
3. Victim deposits `19999e18`; `_tokenToShares` returns `19999e18 * 1 / 10000e18` = `1 wei` shares.
4. Victim redeems immediately and loses ~`9999e18` (half) due to rounding.
5. Attacker also redeems up to `9999e18` burning `0` shares via precision loss.
**How found:** Recognized the well-known first-depositor pricePerShare inflation pattern applied to contracts using pricePerShare accounting; read _tokenToShares/_sharesToToken and noted division by manipulable aToken balance with no minimum-share guard.
**Exploitation:** Attacker seeds 1 wei, donates aToken to inflate pricePerShare, then later depositors' share minting rounds down to ~0; attacker redeems inflated shares and also extracts value via zero-share burns from precision loss.
**Insight:** When share price = totalAssets/totalSupply and totalAssets is a token balance, a direct token transfer inflates it; check for missing minimum-share/mint-dead-shares guard and zero-share burn paths in yield-source adapters.
