From the comment on the code block which stated that
If the stream balance is less than or equal to the total debt, return the stream balance.
Therefore, the check on the _coveredDebtOf function checked for the opposite.
The sablierFlow::refund function is responsible for refunding funds to a specific stream ID. It internally calls the sablierFlow::_refund function, which manages the refund process. However, the _refund function relies on sablier::_refundableAmountOf to calculate the refundable amount, and in turn, sablier::_refundableAmountOf uses sablier::_coveredDebtOf to compute the covered debt based on the stream balance.
The issue lies within the sablier::_coveredDebtOf function, where the check currently ensures that the stream balance is less than the total debt, but it fails to handle cases where the balance is exactly equal to the total debt. As a result, the function does not return the balance in these situations, which could lead to incorrect calculations. Therefore , this will lead to sablierFlow::refundand sablierFlow::refundAndPauseissues when a streamIdrequest for a refund.
The vulnerability affects the accuracy of debt calculations within the system. If the balance is equal to the total debt, this logic would fail to return the correct value, potentially causing financial discrepancies in the system. This could result in unintended behavior, or inaccurate reporting of debts that could mislead users interacting with the protocol.
If User A has 1000 tokens and their total debt is also 1000 tokens, the user will not receive the expected balance. Instead, the function will return an inaccurate debt calculation, which will mislead User A by failing to reflect the correct balance. This will make the User A to not get the accurate refunds.
Manual Code Review
To resolve this issue, update the conditional check to:
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.