The function SablierV2NFTDescriptor::calculateDurationInDays
does not verify if the startTime
provided by user is strictly less than endTime
, causing underflow in the variable durationInDays
when the provided startTime is greater than endTime. Which ultimately calculates the stream's duration in days incorrectly.
Across the codebase, the protocol is usually checking for the inputs being provided by users are correct by employing relavent checks. This check is missing in SablierV2NFTDescriptor
s calculateDurationInDays
function. The function does'nt check whether the startTime
provided by a user is in past and is less than provided endTime
. A user can provide inputs such that the startTime
is greater than endTime
causing underflow in durationInDays
variable which goes unchecked for overflows and underflows as its wrapped inside unchecked keyword. ultimately calculates the stream's duration in days incorrectly.
A malicious user can provide timestamps such that the startTime
is in future and is greater than endTime
and this goes unnoticed as the function lacks a check. when the startTime
is greater than endTime
underflow occurs in durationInDays
as its inside unchecked block, because solidity skips those safety checks for underflows and overflows when we use unchecked
keyoword. this underflow can cause significant precision loss and resulting in calculating the streams duration incorrectly. and this wrong duration will be used to generate svg
and ultimately tokenURI
. everything will be calculated incorrectly due to this small missing check.
Manual analysis
1.employ a check for the timestamps in the beginning of the function, check the startTime
is less than endTime
, if not the function should revert throwing an error. make an custom error and put it inside the check, which is thrown when startTime is not less than endTime.
2.remove unchecked block, if its not that important.
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.