# Victim's fund can be stolen due to rounding error and exchange rate manipulation

Napier LST adapter's zero-share check insufficient; attacker front-runs victim deposit with 1 wei and direct stETH transfer to inflate exchange rate, stealing 25% of victim funds.

- Payout: Contest reward
- Severity: high
- Program: Napier
- Credited: Bandit
- Disclosed: 2024-01-24
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-01-napier-judging/issues/94
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-01-napier%3AH-4
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:race-window vuln:business-logic vuln:oracle-manipulation vuln:precision-loss vuln:share-inflation

**Target:** BaseLSTAdapter.prefundedDeposit (ERC4626-style vault)
**Root cause:** prefundedDeposit only reverts when shares==0, but totalAssets uses balanceOf, so direct token transfers inflate assets-per-share; a victim deposit can round down to 1 wei share while attacker holds 50% of shares.
**Steps:**
1. Victim submits deposit of 10 ETH when no shares exist.
2. Attacker front-runs with 1 wei deposit, minting 1 wei estETH share (and PT+YT).
3. Attacker directly transfers 5 stETH to adapter, making exchange rate 1 wei / (5 ETH + 1 wei).
4. Victim's tx executes: shares = 10 ETH * 1 wei / (5 ETH + 1 wei) = 1 wei (round-down).
5. Attacker redeems 1 wei estETH share via PT+YT, receiving (15 ETH + 1 wei)/2 ≈ 7.5 ETH.
6. Attacker profits ~2.5 ETH (25% of victim deposit).
**How found:** Reviewer noted the zero-share guard in prefundedDeposit and reasoned that balanceOf-based totalAssets allows donation attacks; constructed a rounding-error scenario where victim gets 1 wei share while attacker holds 50%.
**Exploitation:** Attacker observes victim deposit in mempool, front-runs with minimal deposit and direct stETH transfer to inflate share price, then redeems inflated share after victim deposit rounds down.
**Insight:** Zero-share revert is not enough for ERC4626 inflation defense when totalAssets uses balanceOf; check for direct-transfer donation vectors and simulate rounding with tiny initial share supply.
