Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owner can DoS MasterChef rewards #237

Closed
code423n4 opened this issue Feb 9, 2022 · 3 comments
Closed

Owner can DoS MasterChef rewards #237

code423n4 opened this issue Feb 9, 2022 · 3 comments
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

Comments

@code423n4
Copy link
Contributor

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 for totalAllocPoint to reach uint(-1). Then, any reward call for other token will give zero reward if earlier operated multipliers weren't close to uint(-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 by uint(-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.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Feb 9, 2022
code423n4 added a commit that referenced this issue Feb 9, 2022
@r2moon r2moon added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Feb 16, 2022
@r2moon
Copy link
Collaborator

r2moon commented Feb 16, 2022

The reward will be allocated by owner, so owner won't DoS reward.

@GalloDaSballo
Copy link
Collaborator

I disagree with the sponsor that the owner won't DOS just because "trust".

Personally I think the finding has merit in that the math can be made to break, but ultimately this would have pretty much zero impact as people could just withdraw.

Also the likelihood of the sponsor doing this accidentally is pretty much zero as they would need to setup more rewards than the atom in the universe.

For these reasons I believe non-critical to be more appropriate

@GalloDaSballo GalloDaSballo added 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Apr 12, 2022
@JeeberC4 JeeberC4 added 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 and removed 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation labels Apr 21, 2022
@JeeberC4
Copy link

Adding to warden's QA Report #241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants