Closed sherlock-admin3 closed 3 months ago
This issue is invalid according to Sherlock's Criteria for the following reasons:
It falls into the category of gas optimizations, which is considered invalid. Lack of user input validation is considered an invalid issue.
0xMAKEOUTHILL
High
Insufficient validation in
onModify
functionSummary
Insufficient validation in
MasterChefRewarder's
onModify
allows for user to arbitrary change balance of another user without permission.Vulnerability Detail
By the comments above you can see that the function is supposed to be called by the
caller
, but since no validation is added anyone can call the functiononModify
with arbitrary params.Which then calls
BaseRewarder's OnModify
:The check for msg.sender != caller will pass since the msg.sender will be the
MasterChefRewarder
and then _update is called:And here with arbitrary params set by the user calling the function he can decrease\increase rewards and balances for particular user.
Impact
Loss of funds for the protocol
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/MasterChefRewarder.sol#L68-L78
Tool used
Manual Review
Recommendation
Add the validation for the caller of the function