# WstEth derivative assumes a ~1=1 peg of stETH to ETH

WstEth derivative's withdraw computes Curve minOut from a 1:1 stETH/ETH peg, so unstaking reverts when stETH trades below peg, locking user funds.

- Payout: Contest reward
- Severity: high
- Program: Asymmetry Finance
- Credited: adriro
- Disclosed: 2023-07-28
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2023-03-asymmetry-findings/issues/588
- Library page: https://bugbountylibrary.com/r/c4%3A2023-03-asymmetry%3AH-06
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:oracle-manipulation

**Target:** SafEth WstEth derivative withdraw / Curve stETH-ETH pool
**Root cause:** withdraw sets minOut = stEthBal * (1 - maxSlippage) assuming stETH≈ETH, ignoring actual Curve pool rate; ethPerDerivative likewise returns wstETH->stETH without ETH conversion.
**Steps:**
1. Fork mainnet at block ~15000000 (stETH ~0.93 ETH).
2. safEth.addDerivative(wstEth, 1e18); user stakes 1 ether via safEth.stake{value:1 ether}().
3. User calls safEth.unstake(userShares).
4. withdraw unwraps wstETH, approves Curve pool, computes minOut = stEthBal*(1e18-maxSlippage)/1e18 (~0.99).
5. Curve exchange(1,0,stEthBal,minOut) reverts 'Exchange resulted in fewer coins than expected' since rate ~0.93.
**How found:** Code reading of ethPerDerivative and withdraw: noticed minOut derived purely from stETH balance with slippage, implying an implicit 1:1 peg assumption; validated against historical June 2022 depeg (~0.93) via mainnet fork PoC.
**Exploitation:** Not an attacker extraction; failure mode is DoS of unstake/rebalanceToWeights (which withdraws entire balance) during depeg, trapping users. Raising maxSlippage instead exposes rebalancing to MEV sandwich attacks.
**Escalation:** rebalanceToWeights withdraws all derivative balance, so a depeg blocks full rebalancing, not just single-user exits.
**Insight:** When a derivative's minOut is computed from nominal balance rather than an oracle/pool quote, check historical depeg events and whether the same assumption appears in the pricing function (ethPerDerivative) used for share accounting.
