A vulnerability was identified in the vesting rate calculation within the smart contract. If the vestingPeriod
is modified, it can result in a vestingRate
exceeding the maximum value of 1e18.
The issue arises when an administrator changes the vestingPeriod
to a smaller value after stakes have been made. This can lead to an incorrect calculation of the vestingRate
, allowing it to exceed 1e18.
Initial conditions:
stakeTime = 300
vestingPeriod = 200
Administrator changes the vestingPeriod
to 50.
The current timestamp is 401.
The vestingRate
calculation will be 2e18.
This calculation results in a vestingRate
of 2e18, which is twice the intended maximum rate.
Allowing the vestingRate
to exceed 1e18 can lead to incorrect vesting and potential financial discrepancies within the smart contract.
Manual Review
Implement a check in the _getVestingRate
function to ensure the vestingRate
does not exceed 1e18:
This ensures that the vestingRate
is capped at 1e18, preventing the vulnerability from being exploited.
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.