Owner can DoS MasterChef
rewards
#237
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L86-L101
Vulnerability details
Impact
Owner can DoS all
MasterChef
rewards by adding a new token with very high_allocationPoints
parameter, for example fortotalAllocPoint
to reachuint(-1)
. Then, any reward call for other token will give zero reward if earlier operated multipliers weren't close touint(-1)
(which will probably be the case). Any call to reward on the just added token will revert as reward calculation overflows (multiplying a number larger than 1 byuint(-1)
). Thus the owner can stop all rewards to arrive, this can be done by mistake or as a deliberate action. Note that this cannot be undone.Tools Used
Manual analysis
Recommended Mitigation Steps
Limit possible
_allocationPoints
to fit withing a large enough range to provide precision, but small enough not to cause overflow in any scenario.Note that despite this mitigation, current mechanics enables the owner to inflate rewards for other tokens. This model may need to be reviewed.
The text was updated successfully, but these errors were encountered: