#  Mismatch in withdraw() between Yearn and other protocols can prevent Users from redeeming zcTokens and permanently lock funds

Swivel's withdraw() passed underlying-asset amounts to Yearn's withdraw(), which interprets them as shares, causing reverts or excess assets locked in the contract.

- Payout: Contest reward
- Severity: high
- Program: Swivel
- Credited: scaraven
- Disclosed: 2022-09-29
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2022-07-swivel-findings/issues/43
- Library page: https://bugbountylibrary.com/r/c4%3A2022-07-swivel%3AH-01
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error

**Target:** Swivel.sol withdraw() integration with Yearn vault
**Root cause:** Yearn's withdraw(amount) burns `amount` shares, while Euler/ERC4626/Compound/Aave treat amount as underlying assets; Swivel passed the asset amount directly, so the units mismatch.
**Steps:**
1. Note Yearn vault holds 50 shares / 200 uTokens; user deposits 100 uTokens, minting 25 shares (75 shares / 300 uTokens).
2. After maturity user redeems 100 zcTokens; Swivel calls Yearn withdraw(100) intending 100 uTokens.
3. Yearn interprets 100 as shares > 75 available, so tx reverts; user can only withdraw 75 uTokens.
4. Alt scenario: vault 50 shares/100 uTokens, deposit mints 50 shares (100 shares/200 uTokens); withdraw(100) burns 100 shares returning 200 uTokens, leaving 100 uTokens stranded and no shares for other users.
**How found:** Compared Yearn's documented withdraw semantics (amount = shares burnt) against Euler/ERC4626/Compound/Aave (amount = underlying assets) and traced how Swivel.sol forwards the zcToken redemption amount unchanged.
**Exploitation:** Any user redeeming zcTokens after maturity triggers the mismatched withdraw; depending on share balance the call reverts (funds unredeemable) or over-withdraws assets that remain permanently locked in Swivel.sol, blocking later withdrawals.
**Insight:** When integrating multiple yield protocols behind one interface, verify each protocol's unit semantics for deposit/withdraw amounts (shares vs assets); Yearn is the outlier that treats withdraw amount as shares.
