Liquid Staking

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

Withdraw `event` is emitted in internal `_withdraw()` function instead of external `withdraw()` function

Summary

Withdraw event is emitted in internal _withdraw() function instead of external withdraw() function

Vulnerability Details

When a user withdraws his tokens using priorityPool:withdraw(), it calls an internal function _withdraw() & emits the Withdraw event. Now the problem is Withdraw event is emitted in internal _withdraw() instead of main withdraw()

function withdraw(
uint256 _amountToWithdraw,
uint256 _amount,
uint256 _sharesAmount,
bytes32[] calldata _merkleProof,
bool _shouldUnqueue,
bool _shouldQueueWithdrawal
) external {
....
// attempt to withdraw if tokens remain after unqueueing
if (toWithdraw != 0) {
IERC20Upgradeable(address(stakingPool)).safeTransferFrom(
account,
address(this),
toWithdraw
);
@> toWithdraw = _withdraw(account, toWithdraw, _shouldQueueWithdrawal);
}
token.safeTransfer(account, _amountToWithdraw - toWithdraw);
}
function _withdraw(
address _account,
uint256 _amount,
bool _shouldQueueWithdrawal
) internal returns (uint256) {
....
@> emit Withdraw(_account, _amount - toWithdraw);
return toWithdraw;
}

Impact

Event with wrong withdrawal amount will be emitted because _withdraw() only withdraws a subset of total withdrawal amount.

Tools Used

Manual Review

Recommendations

Emits the Withdraw event in the main withdraw()

Updates

Lead Judging Commences

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

Wrong value emitted in PriorityPool::withdraw event

Support

FAQs

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