Open c4-bot-1 opened 6 months ago
Hey @alex-ppg, I noticed this is a valid issue, could you please explain why it's invalid, thank you.
Hey @evokid, thanks for your input. This submission is invalid as the time should be appropriately updated whenever a harvest occurs to avoid incorrect reward disbursement. I will not elaborate further, and advise you to investigate the codebase as well as online resources to understand why.
Lines of code
https://github.com/code-423n4/2024-05-munchables/blob/57dff486c3cd905f21b330c2157fe23da2a4807d/src/managers/LockManager.sol#L414
Vulnerability details
Impact
unlock with partial quantity will reset the last harvest time in account manager. So, the user will lose rewards ...etc.
Proof of Concept
forceHarvest at accountManager.forceHarvest(msg.sender) can be an issue since it updates lastHarvestDate to the current block.timestamp.
A user called unlock with partial
_quantity
, aforceHarvest
is done at:and now all the rewards harvested according to secondsToClaim, which is:
The issue here when a user try to claim the remaining of lockedToken.quantity, there will be no harvest rewards for it, and users now need to wait for a period of time so they can harvest rewards for the remining quantity.
Assuming Bob has lockedToken.quantity = 100e18.
unlock
again for the remaining _quantity as 90e18, but doesn't harvest any rewards, since forceHarvest relys onlastHarvestDate
.Tools Used
Manual Review
Recommended Mitigation Steps
Pass _quantity to
forceHarvest
method and update the code.Assessed type
Other