Closed sherlock-admin2 closed 1 year ago
2 comment(s) were left on this issue during the judging contest.
0xyPhilic commented:
invalid because having a malicious rewarder is purely theoretical so the issue can be considered low
Kral01 commented:
Needs PoC.
feelereth
high
_getPendingReward() function is vulnerable to manipulation of the rewardPerToken
Summary
_getPendingReward() function is vulnerable to manipulation of the rewardPerToken by a malicious reward contract.
Vulnerability Detail
This assumes enRewardPerToken (the current reward per token from the rewarder contract) will always be >= stRewardPerShare (the stored reward per token).
A malicious rewarder contract could manipulate rewardPerToken() to decrease it below the stored value. This would make share a very large number. When multiplied by the user's balance, it could withdraw unexpectedly large rewards.
Impact
If stRewardPerShare was 100 and the malicious contract returned 50 for rewardPerToken(), share would be 50. This could let the user steal 50x their balance in rewards.
Code Snippet
https://github.com/sherlock-audit/2023-07-blueberry/blob/main/blueberry-core/contracts/wrapper/WConvexPools.sol#L139-L142
Tool used
Manual Review
Recommendation
Store the last enRewardPerToken and compare to make sure it increases each time