# YieldEthStakingLido lacks a limit on the max stake amount, which may result in the unstake exceeding MAX_STETH_WITHDRAWAL_AMOUNT, resulting in the token not being retrieved

YieldEthStakingLido stakes without a max cap, so unstake requests above Lido's 1000 stETH MAX_STETH_WITHDRAWAL_AMOUNT revert, locking funds.

- Payout: Audit contest
- Severity: medium
- Program: BendDAO
- Found by: bin2chen
- Disclosed: 2024-09-03
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-benddao-findings/issues/36
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-benddao%3AM-06
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity vuln:business-logic vuln:dos

**Target:** YieldEthStakingLido staking/unstaking contract
**Root cause:** protocolRequestWithdrawal submits the entire withdrawAmount as a single Lido requestWithdrawals call, but Lido rejects any single amount above MAX_STETH_WITHDRAWAL_AMOUNT (1000 stETH); stake() has no matching cap.
**Steps:**
1. User stakes an amount exceeding 1000 stETH (possible when NFT value > MAX*price/leverageFactor, e.g. >$500k at leverageFactor 50000, ETH $2500)
2. User calls unstake(), which invokes protocolRequestWithdrawal
3. Contract calls `IUnstETH.requestWithdrawals(requestAmounts, address(yieldAccount))` with withdrawAmount > 1000e18
4. Lido reverts because amount exceeds MAX_STETH_WITHDRAWAL_AMOUNT, so withdrawReqId is never set and funds stay locked
**How found:** Read the stake/unstake/repay flow, noticed unstake passes the full withdrawAmount as a single requestWithdrawals entry, and cross-checked Lido docs/WithdrawalQueue source for the per-request MAX_STETH_WITHDRAWAL_AMOUNT constant.
**Insight:** When integrating a protocol with per-call min/max amount bounds, check that the wrapper's stake path enforces the same bound as its withdraw path; asymmetric caps leave funds unwithdrawable.

## Proof of concept (copied exactly from the original report)

**protocolRequestWithdrawal builds single requestWithdrawals call**

```
function protocolRequestWithdrawal(YieldStakeData storage sd) internal virtual override {
    IYieldAccount yieldAccount = IYieldAccount(yieldAccounts[msg.sender]);

    uint256[] memory requestAmounts = new uint256[](1);
    requestAmounts[0] = sd.withdrawAmount;
    bytes memory result = yieldAccount.execute(
      address(unstETH),
@>    abi.encodeWithSelector(IUnstETH.requestWithdrawals.selector, requestAmounts, address(yieldAccount))
    );
    uint256[] memory withdrawReqIds = abi.decode(result, (uint256[]));
    require(withdrawReqIds.length > 0 && withdrawReqIds[0] > 0, Errors.YIELD_ETH_WITHDRAW_FAILED);
    sd.withdrawReqId = withdrawReqIds[0];
  }
```

