The _create function in the SablierFlow contract is responsible for the creation of new streams by initializing a Flow.Stream
struct with user-provided parameters, including ratePerSecond
. However, there is a lack of comprehensive validation for the ratePerSecond
parameter to keep it within a reasonable range.
The ratePerSecond
value directly influences the debt accumulation rate, therefore an inadequate constraints may result in streams that are non-functional or destabilizing. Specifically, without setting bounds, it is possible to create streams with either an extremely low rate (e.g., zero) or an unusually high rate, which could lead to excessive gas consumption during updates causing Denial of Service for the stream owner.
Without setting up a bound to ratePerSecond value, it can expose it to two of its lowest and highest bound indices.
When ratePerSecond
is set to zero, this means creating a stream with a zero rate, meaning no tokens will ever be streamed, rendering the stream non-functional.
Setting up ratePerSecond
is set to extremely high value, can lead to arithmetic overflow during the calculation, causing the transactions to revert and thus causing a DoS conditions for the stream owner.
Exploit Prerequisites:
A user can call the _create
function to create a new stream.
The user provides a ratePerSecond
value of excessively large number.
Using an extremely high ratePerSecond
can cause arithmetic operations such as multiplication in _ongoingDebtScaledOf
to overflow.
For a zero rate, the impact is minimal since creating a stream with a zero rate does not affect other users or the protocol. The stream owner may be confused by the non-functional stream.
But for a a higher rate, transactions involving the affected stream will revert due to arithmetic overflows. However, the issue is isolated to the stream with the excessive rate and does not impact other streams or users. Therefore it results to a denial-of-service for the stream owner, who cannot interact with their own stream.
Manual Review
It is essential to validate ratePerSecond
to bound it to a reasonable maximum limit in order to prevent overflows:
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.