# First depositor inflation attack in PendlePowerFarmToken

First depositor inflates PendlePowerFarmToken share price via compounding-reward donation, so a victim's 1e18 deposit mints only 2 shares and loses ~0.6e18 on withdrawal.

- Payout: Contest reward
- Severity: medium
- Program: Wise Lending
- Credited: SBSecurity
- Disclosed: 2024-05-03
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-02-wise-lending-findings/issues/271
- Library page: https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AM-03
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:chained technique:source-review vuln:business-logic vuln:oracle-manipulation vuln:share-inflation

**Target:** PendlePowerFarmToken / PendlePowerFarmController share accounting
**Root cause:** previewMintShares divides by underlyingLpAssetsCurrent, which can be inflated by addCompoundRewards donations without minting shares, so a tiny first deposit plus a large reward donation skews the share price against later depositors.
**Steps:**
1. Attacker picks a PendlePowerFarmToken with no prior deposits.
2. Call `depositExactAmount` with 2 wei; this triggers `syncSupply`→`_updateRewards`, enabling `exchangeRewardsForCompoundingWithIncentive`. Attacker mints 2 shares; totalSupply=3, underlyingLpAssetsCurrent=3.
3. Front-run victim by calling `PowerFarmController::exchangeRewardsForCompoundingWithIncentive`→`addCompoundRewards` with `999999999999999996`, raising totalLpAssetsToDistribute which `_syncSupply` adds to underlyingLpAssetsCurrent.
4. Victim deposits `1e18`; `previewMintShares` = `1e18*3/(1e18-1)` = 2 shares.
5. Victim withdraws: `previewAmountWithdrawShares` = `1*(2e18-1)/5` ≈ 0.4e18, losing ~0.6e18.
**How found:** Code review of share math: noticed previewMintShares divides by underlyingLpAssetsCurrent which addCompoundRewards can raise without minting shares, and that exchangeRewardsForCompoundingWithIncentive refunds the donated amount as rewardTokens, making the inflation cost-free.
**Exploitation:** Attacker seeds 2 wei, then donates ~1e18 of compounding rewards (recovered as rewardTokens via the exchange function, making inflation free) to inflate underlyingLpAssetsCurrent before the victim's deposit, diluting victim shares and capturing value on withdrawal.
**Insight:** When a share-price formula divides by an asset counter, check every path that mutates that counter (reward/compounding donations) for one that doesn't mint shares — and whether the donor gets the value back, turning classic inflation into a free grief.
