Closed code423n4 closed 1 year ago
The Proof of Concept
is not convincing.
I get the point that it could break some potential integrations, but one could argue that it is a valid design as long as no one can steal someone else rewards and that integrators have to deal with it.
Picodes changed the severity to QA (Quality Assurance)
Picodes marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2022-11-redactedcartel/blob/main/src/PirexRewards.sol#L373-#L417
Vulnerability details
Impact
Proof of Concept
Currently, function
claim
inPirexRewards
does not check if caller is the user claiming reward and instead makeuser
as a parameter. This makes anyone able to claim reward for others. There are many reasons why this should not happen. Imagine a user has a reward of1000
, then someone callsclaim
reward for him and when he call functiongetUserState
, he will see his reward decrease significantly since it's claimed. Furthermore, there might be some users who want to keep his/her locked in system and claim it later.Tools Used
Manually review
Recommended Mitigation Steps
I recommend that function
claim
should removeuser
parameter and claim reward formsg.sender
instead, or at least check ifmsg.sender
is therewardRecipient
if you want the recipients to be able to claim reward too.