You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
Unclaimed rewards from the emergencyWithdraw() function remain permanently locked in the MlumStaking contract
Summary
When using the emergencyWithdraw() function, rewards are not sent to the user, and the unclaimed rewards become permanently locked in the MlumStaking contract.
Vulnerability Detail
When the emergencyWithdraw() function is called, the harvest process is skipped, so any accumulated rewards are not sent to the user. Additionally, there is no mechanism to release the user's unclaimed rewards. As a result, those rewards become permanently locked in the MlumStaking contract, as there is no sweep function to retrieve them.
function emergencyWithdraw(uint256tokenId) externaloverride nonReentrant {
_requireOnlyOwnerOf(tokenId);
StakingPosition storage position = _stakingPositions[tokenId];
// position should be unlockedrequire(
_unlockOperators.contains(msg.sender)
|| (position.startLockTime + position.lockDuration) <=_currentBlockTimestamp() ||isUnlocked(),
"locked"
);
// emergencyWithdraw: lockeduint256 amount = position.amount;
// update total lp supply
_stakedSupply = _stakedSupply - amount;
_stakedSupplyWithMultiplier = _stakedSupplyWithMultiplier - position.amountWithMultiplier;
// destroy position (ignore boost points)_destroyPosition(tokenId);
emitEmergencyWithdraw(tokenId, amount);
stakedToken.safeTransfer(msg.sender, amount);
}
Impact
Rewards not claimed during the emergencyWithdraw() function become permanently locked in the MlumStaking contract.
sherlock-admin4
changed the title
Smooth Taffy Moth - Unclaimed rewards from the emergencyWithdraw() function remain permanently locked in the MlumStaking contract
KupiaSec - Unclaimed rewards from the emergencyWithdraw() function remain permanently locked in the MlumStaking contract
Jul 29, 2024
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
KupiaSec
High
Unclaimed rewards from the
emergencyWithdraw()
function remain permanently locked in theMlumStaking
contractSummary
When using the
emergencyWithdraw()
function, rewards are not sent to the user, and the unclaimed rewards become permanently locked in theMlumStaking
contract.Vulnerability Detail
When the
emergencyWithdraw()
function is called, the harvest process is skipped, so any accumulated rewards are not sent to the user. Additionally, there is no mechanism to release the user's unclaimed rewards. As a result, those rewards become permanently locked in theMlumStaking
contract, as there is no sweep function to retrieve them.Impact
Rewards not claimed during the
emergencyWithdraw()
function become permanently locked in theMlumStaking
contract.Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L536-L560
Tool used
Manual Review
Recommendation
It is recommended to either:
emergencyWithdraw()
function by subtracting the unclaimed amount from_lastRewardBalance
.+ _lastRewardBalance -= unclaimedRewards; // unclaimedRewards should be calculated
Duplicate of #460
The text was updated successfully, but these errors were encountered: