# Slashing NativeVault will lead to locked ETH for the users

Slashing a NativeVault node double-decrements totalAssets, so a fully-withdrawing user receives 26 ETH instead of 29, locking 3 ETH permanently.

- Payout: Audit contest
- Severity: high
- Program: Karak
- Found by: zanderbyte
- Disclosed: 2024-10-07
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2024-07-karak-findings/issues/102
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-karak%3AH-01
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** NativeVault.sol staking/slashing/withdrawal accounting
**Root cause:** nodeBalanceWei is computed after _transferToSlashStore() already reduced the node balance, so the slashed amount is subtracted twice: once via the slash transfer and again via the snapshot balance delta applied in _decreaseBalance.
**Steps:**
1. Alice stakes 32 ETH via createNode, validateWithdrawalCredentials, startSnapshot, validateSnapshotProofs: totalAssets=32e18, totalSupply=32e18, totalRestakedETH=32e18.
2. 3 ETH slashing occurs, totalAssets drops to 29e18.
3. Alice withdraws all ETH from beacon chain; node balance is 32 ETH.
4. Call startSnapshot: _transferToSlashStore slashes 3 ETH, totalRestakedETH=29e18, snapshot nodeBalanceWei=29e18.
5. Call validateSnapshotProofs: balanceDeltaWei=-32e18, totalDeltaWei=29e18-32e18=-3e18, shares reduced by 3e18; node.totalRestakedETH=26e18, withdrawableCreditedNodeETH=29e18, balanceOf(alice)=28689655172413793104, totalAssets=26e18.
6. Call startWithdraw: withdrawableWei = min(convertToAssets(shares)=26e18, withdrawableCreditedNodeETH=29e18) = 26e18.
7. Call finishWithdraw: 26e18 sent, all shares burned, 3 ETH stuck in node.
**How found:** Reasoned through the slashing-then-withdrawal flow and noticed totalAssets is decremented twice: once by _transferToSlashStore during startSnapshot and again by the snapshot balance delta in _decreaseBalance, making convertToAssets understate the user's claim.
**Exploitation:** No attacker; a slashed node owner performing a normal full withdrawal receives 26 ETH instead of the 29 ETH owed, and the 3 ETH difference remains permanently locked in the contract.
**Insight:** In share-based vaults, check whether a slashing/loss transfer and a subsequent snapshot balance-delta both decrement totalAssets for the same event; trace convertToAssets vs credited-balance min() to spot double-counted losses.

