# Incorrect shares accounting cause liquidations to fail in some cases

Vault burns shares for yield claims without updating total_shares, so later liquidations try to burn more shares than the vault holds and revert.

- Payout: Contest reward
- Severity: high
- Program: Fair Funding
- Credited: hickuphh3
- Disclosed: 2023-02-03
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2023-02-fair-funding-judging/issues/38
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-02-fair-funding%3AH-2
- Tags: domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:liquidation

**Target:** Vyper Vault contract (withdraw_underlying_to_claim / liquidate)
**Root cause:** withdraw_underlying_to_claim burns vault-held shares to distribute yield but does not decrement total_shares, so position.shares_owned sums exceed actual vault shares.
**Steps:**
1. Deploy Vault, whitelist vault/users in Alchemist, mint NFTs, deposit 1e18 WETH each for admin and user1
2. user2 calls `alchemist.repay(weth, 0.1e18, vaultAdd)` to simulate yield
3. Call `vault.withdraw_underlying_to_claim(convertUnderlyingTokensToShares(yieldToken,0.01e18)+100, 0.01e18)` to mark claimable yield, burning vault shares without updating total_shares
4. user1 calls `vault.liquidate(2,0)` succeeds
5. admin calls `vault.liquidate(1,0)` reverts with arithmetic underflow because contract burns more shares than it holds
**How found:** Code review of share accounting: noticed withdraw_underlying_to_claim burns shares but leaves total_shares stale, then reasoned liquidation uses shares_owned directly, causing over-burn.
**Exploitation:** Not weaponized; griefing/DoS where a position's liquidation reverts after yield distribution, blocking liquidation of that NFT position.
**Insight:** When a contract burns its own shares/tokens for distributions, check whether the global accounting variable (total_shares) is decremented; stale totals surface later in per-position burn paths like liquidation.
