# Base pools can get bricked if depositors pull out

Rounding in Sentiment pool withdraw lets attacker leave 1 asset with 0 shares, bricking deposit() and DoSing targeted pool owners.

- Payout: Audit contest
- Severity: medium
- Program: Sentiment
- Found by: 000000
- Disclosed: 2024-08-07
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-08-sentiment-v2-judging/issues/400
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-sentiment-v2%3AM-17
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:precision-loss

**Target:** Lending pool contract (Pool.sol) deposit/withdraw share accounting
**Root cause:** Withdraw rounds asset-to-share conversion up, so subtracting shares can zero out totalDepositShares while totalDepositAssets stays >0. convertToShares then returns 0 for any deposit, reverting with Pool_ZeroSharesDeposit.
**Steps:**
1. Initialize pool for victim address (or front-run victim's init) with a rate model.
2. Attacker deposits assets into the pool.
3. Attacker borrows a small amount to trigger interest accrual so totalDepositAssets > totalDepositShares.
4. Attacker repays, then calls `pool.withdraw(vicPoolId, totalDepositAssets - 1, attacker, attacker)` leaving 1 asset and 0 shares.
5. Subsequent `pool.deposit(...)` reverts with Pool_ZeroSharesDeposit — pool bricked.
**How found:** Code review of withdraw share math: noticed asset->share conversion rounds up, allowing share subtraction to hit zero while assets remain; reasoned that convertToShares then yields 0 and deposit reverts.
**Exploitation:** Attacker needs only to be sole depositor: deposit, borrow to accrue interest, repay, withdraw all but 1 asset. Rounding leaves totalDepositAssets==1, totalDepositShares==0. Since poolId = keccak256(owner, asset, rateModelKey), attacker can pre-initialize and brick all pool IDs for a target address, blocking that address from operating pools.
**Escalation:** Enumerate all (asset, rateModelKey) combos for a victim owner to brick every pool ID they could initialize, denying service to specific users/protocols.
**Insight:** In ERC4626-style pools, check invariants where totalAssets>0 but totalSupply==0 after rounding-up conversions; a sole depositor can drive this state and permanently DoS deposit by exploiting poolId determinism to pre-brick IDs.

