# Withdrawing after a slash event before the vault has ended will decrease `fixedSidestETHOnStartCapacity` by less than it should, so following users will withdraw more their initial deposit

LidoVault.withdraw reduces fixedSidestETHOnStartCapacity by the slashed amount instead of the nominal deposit, letting later fixed depositors withdraw more than they deposited at variable users' expense.

- Payout: Audit contest
- Severity: medium
- Program: Saffron Finance
- Found by: 0x73696d616f
- Disclosed: 2024-08-05
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-saffron-finance-judging/issues/92
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-saffron-finance%3AM-2
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** LidoVault.sol withdraw() accounting
**Root cause:** On early withdrawal after a slash, withdraw() decrements fixedSidestETHOnStartCapacity by the lossy stETH amount actually paid out rather than the nominal fixedETHDeposits share, leaving the capacity too high.
**Steps:**
1. Lido slash drops stETH/share ratio (e.g. 100 ETH/100 shares -> 90 ETH/100 shares).
2. User A (50% bearer tokens) calls `withdraw()`; receives `lidoStETHBalance.mulDiv(fixedBearerToken[A], fixedLidoSharesTotalSupply())` = 45 ETH.
3. fixedSidestETHOnStartCapacity is reduced by 45 instead of the nominal 50, leaving 55.
4. Lido ratio recovers; User B withdraws `fixedSidestETHOnStartCapacity * 50 / 50` = 55 ETH despite depositing 50.
**How found:** Code reading of withdraw()'s early-exit branch: noticed the capacity decrement used the same lossy mulDiv amount as the payout, contradicting the comment that users should only ever get their initial deposit or less.
**Exploitation:** Any fixed depositor exits early after a slashing event, locking in the lossy payout while the capacity counter is under-decremented; subsequent fixed depositors withdraw the recovered surplus, shifting the slash loss onto variable depositors.
**Insight:** When a contract tracks a 'capacity' or 'remaining principal' counter alongside actual token balances, check that the counter is decremented by nominal principal, not by the current (possibly depegged/slashed) token value; ratio changes between events leak value between user classes.

