Open code423n4 opened 2 years ago
Duplicate #61
@LilYeti: In #61 it has description and explanation why should be severity 1.
Taking as main
From #61:
@LilYeti : MasterChef is a decently well trusted contract and all JLP rewards are distributed there. Fundamentally the number should not be off by any, if any will be dust, and this exists to protect in the worst case so at least some users can get JOE out. However it is a backstop and extra safety measure. In #137 the reward being off by 10 would require an additional bug somewhere else, or a failure of MasterChef.
Handle
csanuragjain
Vulnerability details
Impact
Monetary loss for user
Proof of Concept
Navigate to contract at https://github.com/code-423n4/2021-12-yetifinance/blob/main/packages/contracts/contracts/AssetWrappers/WJLP/WJLP.sol
Let us see _sendJoeReward function
Lets say user reward are calculated to be 100 so _safeJoeTransfer is called with joeToSend as 100. Also user remaining reward becomes 0
Let us see _safeJoeTransfer function
Recommended Mitigation Steps
If the reward balance is lower than user balance then contract must transfer reward balance in contract and make remaining user reward balance as ( user reward balance - contract reward balance )