Closed sherlock-admin4 closed 6 months ago
1 comment(s) were left on this issue during the judging contest.
panprog commented:
low, dup of #30. ZVL is trusted admin which is expected to provide correct values anyway. So the severity is low for incorrect sanity check which doesn't influence anything.
0xRstStn
medium
createVestingSchedule
allows to create vesting periods with a duration longer than the maximum (i.e. 1800 days)Summary
In contract
ZivoeRewardsVesting
, functioncreateVestingSchedule
is to be used for creating vesting periods. The maximum number of days for a vesting period is 1800 days but in reality much longer periods can be created.Vulnerability Detail
One of the inputs to the function
createVestingSchedule
isdaysToVest
. This input is the number of days for the entire vesting period. WithincreateVestingSchedule
, there is a statement requiringdaysToVest
to be less or equal to1800 days
:The problem comes because
daysToVest
is already defined in days so it is later multiplied bydays
when incorporated investingScheduleOf
:So
daysToVest
could be up to155,520,000
and still be valid.Impact
Although this function is restricted and can only be invoked by
ZVL
orITO
(i.e.onlyZVLOrITO
modifier), if by mistake it is invoked containingdaysToVest
in seconds instead of days, it will go through. Also, if the vesting created is non-revokable, the vesting schedule cannot be ended.Code Snippet
https://github.com/sherlock-audit/2024-03-zivoe/blob/d4111645b19a1ad3ccc899bea073b6f19be04ccd/zivoe-core-foundry/src/ZivoeRewardsVesting.sol#L381-L425
Tool used
Foundry In this test, a vesting schedule with
daysToCliff
of30 days
anddaysToVest
of120 days
is invoked by mistake. It can be seen it goes through and creates it.To run this test, include it within
Test_ZivoeRewardsVesting.sol
The logs resulted from this test is:
Recommendation
Remove
days
from therequire
statement wheredaysToVest
is checked to be<= 1800 days
Duplicate of #151