The function depletionTimeOf
does not validate the snapshotTime
of the stream, allowing for potentially outdated or manipulated snapshots to be used in the depletion time calculation.
https://github.com/Cyfrin/2024-10-sablier/blob/main/src/SablierFlow.sol#L57-#L104
The function does not check if the snapshotTime
is in the future or too far in the past, which could lead to incorrect depletion time calculations.
Lack of time boundary validation makes the function susceptible to time-based attacks, where an bad actor could manipulate the snapshotTime
to their advantage.
Incorrect depletion time calculations could result in inaccurate information being provided to users, potentially leading to financial losses or unexpected behavior in applications relying on this function.
Manual code review
A. Add a check to ensure the snapshotTime
is not in the future:
B. Add a check to ensure the snapshotTime
is not too far in the past, based on your system's requirements:
Suggested fix
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.