# Vault inflation attack in `AutoCompoundingPodLp` is possible due to incorrectly minting dead shares

AutoCompoundingPodLpFactory mints initial shares to msg.sender instead of dead address, enabling vault inflation attack that steals funds from later depositors.

- Payout: Audit contest
- Severity: high
- Program: Peapods Finance
- Found by: X77
- Disclosed: 2025-01-08
- Write-up quality: 8/10
- Original: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/166
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AH-2
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:share-inflation

**Target:** AutoCompoundingPodLp vault contract
**Root cause:** Factory's _depositMin mints minimum deposit shares to msg.sender, not a dead address, so attacker can withdraw them and manipulate share price.
**Steps:**
1. Attacker frontruns deployment; factory mints 1e3 shares to attacker (msg.sender) with 1e3 assets.
2. Attacker transfers 1 reward token to vault, increasing totalAssets to 1e3+1.
3. Attacker withdraws 1e3-1 assets, leaving 2 assets and 1 share.
4. Loop: deposit `2*totalAssets - 1` (mints 1 share), then withdraw 1 asset (burns 1 share), exponentially growing totalAssets while supply stays 1.
5. Victim deposits 20e18 assets but receives only 1 share due to rounding down; attacker redeems 1 share for ~12e18 assets, victim loses ~3.9e18.
**How found:** Code review of factory's _depositMin revealed shares minted to msg.sender instead of dead address, enabling classic inflation attack.
**Exploitation:** Attacker uses initial share mint to themselves, then donates small amount to inflate share price, withdraws most assets to leave 2 assets/1 share, then loops deposit/withdraw to exponentially inflate share value. Victim's deposit rounds down to 1 share, attacker redeems for profit.
**Insight:** When auditing vault factories, check if initial shares are minted to a dead address; if minted to deployer or msg.sender, they can be withdrawn, enabling inflation attacks.

## Proof of concept (copied exactly from the original report)

**Mock increase function for reward accrual**

```
function increase() public {
        _totalAssets += 1;
    }
```

