Vesting Schedule Start and End Time can be Set in the Past
The vesting contract lacks a check that the start and end timestamps are in the future, so an administrator could accidentally create a schedule that has already started and ended. If that happens, recipients can withdraw their entire vested amount immediately.
Submitted by TomJ, also found by ayeslick, csanuragjain, and pashov
There is no check whether _startTimestamp and _endTimestamp is greater than block.timestamp at VTVLVesting.sol _createClaimUnchecked function. Therefore it is possible for administrators to accidentally create vesting schedule that starts and ends in the past without noticing it. When administrators does this and this transaction goes through, then the vesting recipients can withdraw their entire vest amount which is not what administrators intended to do. Add require check that force _startTimestamp to be greater than block.timestamp.
Team comments as below on line 260
// -> Conclusion: we want to allow this, for founders that might have forgotten to add some users, or to avoid issues with
transactions not going through because of discoordination between block.timestamp and sender's local time
However this is not an issue by adding require(_startTimestamp > uint40(block.timestamp)) since this will revert transaction if _startTimestamp is less than block.timestamp so administrators can simply try again with correct time. On the other hand, it is more dangerous to not include this check because transaction will simply succeed even though _startTimestamp is set to past which means that there is a chance of administrators not noticing this.
Proof of Concept
- Admin creates new vesting schedule using
createClaimfunction. However admin mistakenly set_startTimestampand_endTimestampin the past. - Since there is no check of
require(_startTimestamp > uint40(block.timestamp)), this transaction is valid and claim is created. - Vesting recipients calls the
withdrawfunction and receive entire vest amount.
Recommended Mitigation Steps
Add following check in VTVLVesting.sol:_createClaimUnchecked function.
require(_startTimestamp > uint40(block.timestamp), "INVALID_START_TIMESTAMP")
Going to use this issue for encompassing a few different reports that all revolve around adding some better validation around timestamps. These include a few different potential fixes that the sponsor can review, but ultimately point to the same underlying issues.
lawrencehui (VTVL) acknowledged, but disagreed with severity and commented:
As described in the documentation, this back dated (
startTimestamp < block.timestamp) feature is indeed intended as there are many real life cases that founders want to reward their employees in the way the vesting period starts well before Token Generation Event (TGE).We appreciate wardens’ feedback on additional checking (both start and end time) and in our actual application, we would include multiple layer of checking / approval processes in front and backend before the transaction signing happens and therefore the risk is low in our opinion.
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 contract does not validate that the start and end timestamps are later than the current block timestamp when creating a claim.
Impact
Recipients could withdraw their full vest amount immediately, which may not be what the administrator intended; the team says the risk is low because their application adds extra checks before signing.
What the attacker needed
Admin creates a claim with past timestamps; recipient has a claim
The fix
Add a require statement that forces the start timestamp to be greater than the current block timestamp.
How it was found
- Admin calls createClaim with start and end timestamps set in the past.
- The transaction succeeds because there is no check that the start timestamp is in the future.
- The recipient calls withdraw and receives the entire vested amount.
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.
A vesting schedule releases tokens to a person over time. If the schedule's start and end dates are both in the past, the contract thinks all the time has already passed, so the person can take all the tokens at once. The report says an admin could make this mistake because the contract does not reject past dates.
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.