# Belt Finance Logic Error Bugfix Review — Largest Ever Bounty Payout

Belt Finance strategy double-counted withdrawals when wBNB was sent directly to the contract, letting an attacker mint excess shares and drain ~$60M.

- Payout: $1,050,000
- Severity: critical
- Program: Belt Finance
- Credited: Alexander Schlindwein
- Disclosed: 2021-09-30
- Write-up quality: 8/10
- Original: https://immunefi.com/blog/bug-fix-reviews/belt-finance-logic-error-bugfix-review-largest-ever-bounty-payout/
- Library page: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-belt-finance-logic-error-bugfix-review-largest-ever-bounty-payout
- Tags: domain:web3 impact:funds-loss kind:bounty platform:blog platform:immunefi sev:critical tech:evm tech:solidity technique:chained technique:source-review vuln:business-logic vuln:precision-loss

**Target:** BSC yield-farm strategy contract (StrategyAlpacaImpl) and strategy token
**Root cause:** Withdraw decremented balanceSnapshot unconditionally, even when the withdrawal was satisfied from wantLockedInHere without liquidating the yield asset, double-counting the withdrawal and understating total locked funds.
**Steps:**
1. Call `deposit` with BNB to receive normal pro-rata strategy shares.
2. Send wBNB directly to the strategy contract so `wantLockedInHere()` exceeds `_wantAmt`, making the `if(_wantAmt > wantLockedInHere())` check fail.
3. Call `withdraw` for shares; `_withdraw` is skipped but `balanceSnapshot = balanceSnapshot.sub(_wantAmt)` still runs, understating total locked funds.
4. Call `deposit` again; strategy token mints excess shares based on the too-low balance.
5. Call `earn` to overwrite balanceSnapshot from the bank, restoring correct accounting.
6. Call `withdraw` with all shares to claim more BNB than deposited.
**How found:** Researcher noticed the withdraw logic updated balanceSnapshot regardless of whether _withdraw actually liquidated the yield asset, and that a direct token transfer could flip the wantLockedInHere check to skip liquidation while still decrementing the snapshot.
**Exploitation:** Attacker deposits, donates wBNB directly to the strategy contract to force the withdraw branch to skip liquidation, withdraws to corrupt balanceSnapshot, re-deposits to mint excess shares, calls earn to reset snapshot, then withdraws all shares for profit. Repeatable; ~$10M per iteration up to ~$60M total.
**Escalation:** Attack is repeatable in iterations of ~$10M until the entire contract (~$60M) is drained.
**Insight:** In share-based vaults, check whether accounting variables are decremented on paths where the underlying asset is never actually moved; direct token donations can flip branch conditions to desync share price from real holdings.
