Closed code423n4 closed 2 years ago
https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L195-L198) https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L369-L371
rageQuit function call the getRageQuitAmounts to know the amount of penalties that will go to Treasury.
rageQuit
getRageQuitAmounts
To do that, for each different vested period amount it will divide that value by the corresponding month penalty.
If one of those penalty is equal to zero, the function (and so also rageQuit) will revert because of Division or modulo by 0.
Division or modulo by 0
If the rageQuit revert, it means that users can not unstake the vested token and need to wait for the whole vest time.
Manual review
Add a check on the updatePenalties and check that all the penalties are not equal to 0.
updatePenalties
Fair consideration. Lowering risk and merging with the warden's QA report #239
Lines of code
https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L195-L198) https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L369-L371
Vulnerability details
Impact
rageQuit
function call thegetRageQuitAmounts
to know the amount of penalties that will go to Treasury.To do that, for each different vested period amount it will divide that value by the corresponding month penalty.
If one of those penalty is equal to zero, the function (and so also
rageQuit
) will revert because ofDivision or modulo by 0
.If the
rageQuit
revert, it means that users can not unstake the vested token and need to wait for the whole vest time.Proof of Concept
getRageQuitAmounts
functionTools Used
Manual review
Recommended Mitigation Steps
Add a check on the
updatePenalties
and check that all the penalties are not equal to 0.