A vulnerability has been identified in the smart contract's calculation of the manager's cut from remaining rewards. The current implementation using integer division can result in the manager receiving no cut or a significantly undervalued cut, especially for smaller reward amounts.
The vulnerability is present in the following line of code:
uint256 managerCut = remainingRewards / managerCutPercent;
Where managerCutPercent
is a constant set to 10.
The issue arises due to Solidity's integer division, which truncates any fractional results. This leads to several problems:
For any remainingRewards
less than 10, managerCut
will always be 0.
The calculation lacks precision for values not divisible by 10.
There's a sudden jump from 0 to 1 at the threshold of 10 remaining rewards.
The manager faces potential financial loss, particularly with smaller reward pools, as they may receive no cut or a substantially reduced amount. This inaccurate distribution not only deviates from the contract's intended 10% allocation but also undermines the fairness of the reward system.
Here's a simple POC to demonstrate the issue:
Manual review
I recommend implementing a scaled calculation approach to address this vulnerability. This method will preserve precision.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.