Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: low
Valid

Valid withdrawal can be denied due to `minWithdrawalAmount` check in `queueWithdrawal` function

Title

Valid withdrawal can be denied due to minWithdrawalAmount check in queueWithdrawal function

Github link

https://github.com/Cyfrin/2024-09-stakelink/blob/main/contracts/core/priorityPool/WithdrawalPool.sol#L303

https://github.com/Cyfrin/2024-09-stakelink/blob/main/contracts/core/priorityPool/PriorityPool.sol#L679

Summary

When a user requsted withdrawal of amount greater than available queued tokens, remaining should be queued via queueWithdrawal function. But due to minWithdrawalAmount check, the withdrawal request can be denied.

Vulnerability Details

Here's the minWithdrawalAmount check from queueWithdrawal function:

function queueWithdrawal(address _account, uint256 _amount) external onlyPriorityPool {
-> if (_amount < minWithdrawalAmount) revert AmountTooSmall();
lst.safeTransferFrom(msg.sender, address(this), _amount);
uint256 sharesAmount = _getSharesByStake(_amount);
queuedWithdrawals.push(Withdrawal(uint128(sharesAmount), 0));
totalQueuedShareWithdrawals += sharesAmount;
uint256 withdrawalId = queuedWithdrawals.length - 1;
queuedWithdrawalsByAccount[_account].push(withdrawalId);
withdrawalOwners[withdrawalId] = _account;
emit QueueWithdrawal(_account, _amount);
}

Below is a simple scenario that the revert can happen:

  1. Legitimate user requests a withdrawal via PriorityPool contract

  2. PriorityPool contract checks the amount of queued tokens and see if it can be fulfilled.

  3. If it exceeds the queued amount, queueWithdrawal function is called to queue an additional withdrawal.

  4. If the requested amount is smaller than minWithdrawalAmount, the function call would fail despite it being called from authorized party and to be a valid request.

That being said, while the minimum amount check could be valuable in one-time withdrawal requests or so there should be an improvement to deal with above edge cases without any unfair reverts.

Impact

This results in obvious DoS cases.

Tools Used

Manual Review

Recommendations

Check if the amount to queueWithdrawal function is residue or not. In case, min amount check can be skipped.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

A withdrawal of totalQueued + x with x < minWithdrawal amount will revert

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.