Open code423n4 opened 1 year ago
0xean marked the issue as primary issue
Agree with severity and proposed mitigation.
tbrent marked the issue as sponsor confirmed
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
Lines of code
https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/StRSR.sol#L341-L380
Vulnerability details
cancelUnstake
will cancel the withdrawal request in the queue can mint shares as the currentstakeRate
. But it doesn'tpayoutRewards
beforemintStakes
. Therefor it will mint stRsr as a lower rate, which means it will get more rsr.Impact
Withdrawers in the unstake queue can
cancelUnstake
without callingpayoutRewards
to get more rsr rewards that should not belong to them.Proof of Concept
POC test/ZZStRSR.test.ts git patch
The test simulates two users unstake and cancelUnstake operations at the same time.But the addr2 calls payoutRewards after his cancelUnstake. And addr3 calls cancelUnstake after payoutRewards. Addr2 gets more rsr than addr3 in the end.
run test:
log:
Tools Used
Manual review
Recommended Mitigation Steps
Call
_payoutRewards
before mint shares.Assessed type
Math