chaduke - _claimRewardToken() will update accountRewardDebt even when there is a failure during reward claiming, as a result, a user might lose rewards. #1
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
chaduke
High
_claimRewardToken() will update accountRewardDebt even when there is a failure during reward claiming, as a result, a user might lose rewards.
Summary
_claimRewardToken()
will update accountRewardDebt even when there is a failure during reward claiming, for example, when there is a lack of balances or a temporary blacklist that prevents an account from receiving tokens for the moment. As a result, a user might lose rewards.Vulnerability Detail
_claimRewardToken() will be called when a user needs to claim rewards, for example, via
claimAccountRewards() -> _claimAccountRewards() -> _claimRewardToken().
However, the problem is that
_claimRewardToken()
will update accountRewardDebt even when there is a failure during reward claiming, for example, when there is a lack of balances or a temporary blacklist that prevents an account from receiving tokens for the moment.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/14d3eaf0445c251c52c86ce88a84a3f5b9dfad94/leveraged-vaults-private/contracts/vaults/common/VaultRewarderLib.sol#L295-L328
The following code will be executed to update
accountRewardDebt
:Meanwhile, the try-catch block will succeed without reverting even there is a failure: for example, when there is a lack of balances or a temporary blacklist that prevents an account from receiving tokens for the moment.
As a result, a user will lost rewards since
accountRewardDebt
has been updated even though he has not received the rewards.Impact
_claimRewardToken() will update accountRewardDebt even when there is a failure during reward claiming, as a result, a user might lose rewards.
Code Snippet
Tool used
Manual reading and foundry
Manual Review
Recommendation
We should only update
accountRewardDebt
when the claim is successful.The text was updated successfully, but these errors were encountered: