Unconstrained fee
The MasterChef contract allows the admin to set a token fee above 100%, which causes deposit calls to fail due to underflow when subtracting the fee from the reward. This can permanently break the contract's deposit functionality for that token, as the fee cannot be undone.
Submitted by Czar102, also found by defsec, Dravee, harleythedog, hickuphh3, and throttle
Token fee in MasterChef can be set to more than 100%, (for example, by accident) causing all deposit calls to fail due to underflow on subtraction when reward is lowered by the fee, thus breaking essential mechanics. Note that after the fee has been set to any value, it cannot be undone. A token cannot be removed, added, or added the second time. Thus, mistakenly (or deliberately, maliciously) added fee that is larger than 100% will make the contract impossible to recover from not being able to use the token.
Recommended Mitigation Steps
On setting fee ensure that it is below a set maximum, which is set to no more than 100%.
Alex the Entreprenerd (judge) commented:
The warden has identified admin privilege that would enable them to set the deposit fee to 100%. The value can also be increased above 100% to cause a denial of service to the user.
Mitigation would require offering a more appropriate upper limit to the fee.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the fee-setting function lacks an upper bound check, allowing values above 100% that cause an underflow during reward calculation.
Impact
The contract's deposit function becomes unusable for the affected token, and the fee cannot be undone, potentially locking funds or breaking the contract permanently.
What the attacker needed
Admin privileges to set fee
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a smart contract, a fee is a percentage taken from a deposit or reward. If the fee is set higher than 100%, the code tries to subtract a larger number from a smaller one, which causes an error called an underflow. This error makes every deposit fail, and because the fee cannot be changed back, the contract becomes stuck for that token.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.