User can lose extra rewards
The reward manager can call clearExtraRewards to remove extra reward tokens that were already staked for users, leaving those rewards permanently locked with no way for users to claim them. An attacker with the reward manager role could cause users to lose their extra rewards.
Originally disclosed on Code4rena
Submitted by csanuragjain
rewardManager can at anytime delete the extra Rewards. This impacts the extra rewards earned by existing staker. The existing staker will have no way to claim these extra rewards. Since these extra rewards have been staked for all users making a deposit BaseRewardPool.sol#L215 so basically the extra reward gets locked with no one having access to this fund. Need to be fixed for BaseRewardPool.sol as well
Proof of Concept
- rewardManager adds 2 extra reward token A,B using addExtraReward
- User X makes a deposit of amount 1000 using stake function
- This stakes extra rewards A,B for this user
- rewardManager now calls clearExtraRewards which removes extraRewards object
- User X has now no way to retrieve the staked extra rewards A,B of amount 1000
Recommended Mitigation Steps
If rewardManager wants to clear extra rewards then all existing stakes on extra rewards must be withdrawn and claimed so that user extra rewards are not lost.
solvetony (veToken Finance) disagreed with severity and commented:
Not an issue of the user staked fund, but we need to add call at pool factory for
clearExtraRewards().
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
The warden has shown how, due to admin privilege, extra rewards could stay stuck in the contract.
Because this is contingent on a malicious admin, I believe Medium Severity to be more appropriate.
Notice that the rewards would be lost forever as there doesn’t seem to be any
sweepfunction which instead would allow the admin to take the reward tokens.My recommendation is to remove the function to
clearExtraRewardsas it doesn’t seem to help but it can indeed cause issues.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the clearExtraRewards function removes extra reward entries without first withdrawing and claiming the staked amounts, leaving the tokens locked in the contract.
Impact
Extra rewards staked by users could become permanently locked and unclaimable, but this requires a malicious reward manager.
What the attacker needed
RewardManager role; users have staked extra rewards
The fix
The clearExtraRewards function should be removed or modified so that all existing stakes on extra rewards are withdrawn and claimed before clearing.
How it was found
- rewardManager adds 2 extra reward token A,B using addExtraReward
- User X makes a deposit of amount 1000 using stake function
- This stakes extra rewards A,B for this user
- rewardManager now calls clearExtraRewards which removes extraRewards object
- User X has now no way to retrieve the staked extra rewards A,B of amount 1000
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A reward manager is a privileged user who can add or remove extra reward tokens. If they remove those tokens after users have staked, the tokens stay in the contract but no one can retrieve them, so users lose their rewards.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.