rewardTokens removed from WAuraPool/WConvexPools will be lost forever
The pendingRewards function fetches the current list of reward tokens from the underlying Aura/Convex pool each time it is called. If a reward token is later removed from that pool, any unclaimed rewards in that token become permanently locked in the contract and cannot be claimed by users.
Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/128
Found by
0x52
Summary
pendingRewards pulls a fresh count of reward tokens each time it is called. This is problematic if reward tokens are ever removed from the the underlying Aura/Convex pools because it means that they will no longer be distributed and will be locked in the contract forever.
Vulnerability Detail
uint extraRewardsCount = IAuraRewarder(crvRewarder)
.extraRewardsLength();
tokens = new address[](extraRewardsCount + 1);
rewards = new uint256[](extraRewardsCount + 1);
tokens[0] = IAuraRewarder(crvRewarder).rewardToken();
rewards[0] = _getPendingReward(
stCrvPerShare,
crvRewarder,
amount,
lpDecimals
);
for (uint i = 0; i < extraRewardsCount; i++) {
address rewarder = IAuraRewarder(crvRewarder).extraRewards(i);
uint256 stRewardPerShare = accExtPerShare[tokenId][i];
tokens[i + 1] = IAuraRewarder(rewarder).rewardToken();
rewards[i + 1] = _getPendingReward(
stRewardPerShare,
rewarder,
amount,
lpDecimals
);
}
In the lines above we can see that only tokens that are currently available on the pool. This means that if tokens are removed then they are no longer claimable and will be lost to those entitled to shares.
Impact
Users will lose reward tokens if they are removed
Code Snippet
Tool used
Manual Review
Recommendation
Reward tokens should be stored with the tokenID so that it can still be paid out even if it the extra rewardToken is removed.
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
The contract does not store the list of reward tokens per token ID; it re-fetches the current list from the external pool, so removed tokens are no longer tracked and their accrued rewards become unclaimable.
Impact
Users could lose reward tokens if those tokens are removed from the underlying pool, as the rewards would be locked in the contract forever.
What the attacker needed
Reward token removed from Aura/Convex pool
The fix
Reward tokens should be stored with the tokenID so that they can still be paid out even if the extra reward token is removed.
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.
This contract lets people earn rewards from another pool. It checks which reward tokens exist each time someone asks for their pending rewards. If the other pool stops offering a particular reward token, the contract forgets about it, so any rewards already earned in that token are stuck in the contract and can never be paid out.
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.