# Because of the asset: Share 1:1 Conversion, if vault incurs a loss, the last user to withdraw will take the entire loss

PoolV3 keeps a fixed 1:1 share:asset rate, so after a bad-debt loss the last withdrawer absorbs the entire shortfall.

- Payout: Audit contest
- Severity: medium
- Program: LoopFi
- Found by: Infect3d
- Disclosed: 2025-02-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-loopfi-findings/issues/186
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AM-19
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:liquidation

**Target:** PoolV3 lending pool / CDPVault bad-debt liquidation accounting
**Root cause:** PoolV3's _convertToShares/_convertToAssets always return 1:1 regardless of totalAssets vs totalSupply, and repayCreditAccount caps sharesToBurn at treasury balance, so uncovered loss is never socialized across shareholders.
**Steps:**
1. Alice and Bob each deposit 50 ETH into PoolV3, receiving 50 shares each (100 shares, 100 ETH).
2. A CDPVault borrower borrows 80 ETH against 100 ETH collateral; interest accrues over a year.
3. Spot price drops to 0.7 ETH; liquidatePositionBadDebt is called, treasury has 0 shares, so the ~10 ETH loss is uncovered and sharesToBurn is capped at 0.
4. PoolV3 now holds 90 ETH but still has 100 shares at a 1:1 rate.
5. Alice withdraws 50 ETH for her 50 shares, leaving 40 ETH.
6. Bob's withdraw(50 ether) reverts (SafeCast: value must be positive) — he can only recover 40 ETH, absorbing the full loss.
**How found:** Code review of PoolV3's conversion functions noting the hardcoded 1:1 rate, combined with the treasury-cap logic in repayCreditAccount that silently drops uncovered loss instead of reducing share value; confirmed with a Foundry test simulating bad-debt liquidation.
**Exploitation:** Not an attacker-driven exploit; the loss materializes passively when a bad-debt liquidation leaves the pool undercollateralized while the share rate stays 1:1. Early withdrawers exit whole, the last withdrawer eats the shortfall, and a subsequent depositor's funds can be captured by the prior underwater holder.
**Insight:** In ERC-4626-style pools, check whether convertToShares/convertToAssets actually reference totalAssets()/totalSupply(); a fixed 1:1 rate plus any loss path (bad debt, liquidation shortfall) means losses are never socialized and the last withdrawer is the exit-liquidity victim.

