This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
pinalikefruit - Unclaimed Extra Rewards Stuck in Contract After setExtraRewarder Update #559
Labels
Non-Reward
This issue will not receive a payout
pinalikefruit
High
Unclaimed Extra Rewards Stuck in Contract After setExtraRewarder Update
Summary
The
MasterChef
contract includes anextraRewarder
token to incentivize users. However, if theextraRewarder
address is updated, any unclaimed rewards from the previousextraRewarder
cannot be claimed or retrieved, resulting in these tokens being stuck in the contract.Vulnerability Detail
When users make a deposit or withdraw, they receive extra rewards directly. If the
MasterChefV2::setExtraRewarder
function updates theextraRewarder
to a new address, users will start receiving rewards from the newextraRewarder
. However, any unclaimed rewards from the oldextraRewarder
cannot be claimed because the only function to receive the claim, onModify, can only be executed when in the Linked status:Additionally, the function available to the owner for handling reward tokens, sweep, does not allow for the retrieval of unclaimed rewards:
As a result, unclaimed tokens from the old extraRewarder remain stuck in the contract indefinitely.
Impact
Unclaimed extra reward tokens are stuck in the contract forever, effectively lost to users or owner.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/rewarders/MasterChefRewarder.sol#L68-L78
Tool used
Manual Review
Recommendation
Add a function that allows users or the owner to withdraw unclaimed tokens when the contract is unlinked. This ensures that users can retrieve any rewards owed to them even after an extraRewarder update.
The text was updated successfully, but these errors were encountered: