When the creator of a stream cancels the stream, and the recipient address is a contract it calls ISablierV2Recipient(recipient).onLockupStreamCanceled
function on the contract, this call is put inside a try-catch to prevent revert if the contract didn't implement this function.
The problem is that a malicious contract can implement this function and put a very large loop within it. This will grieve the stream creator if he ever tries to cancel the stream. The stream creator will have to pay more gas fees in order to cancel the stream.
Alice creates a stream for Bob with 10000USDC.
Bob and Alice disagree so she wants to cancel the stream.
Before she could do that Bob sends this streams to a contract he controls. That has a large loop within it's fallback.
The cost to cancel the stream will become too expensive for Alice.
So Bob keeps his stream and Alice loses money.
Create a file at the root of your unit test
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/test/unit
and paste the test code below inside that file.
Run the code
[PASS] testCancelPOC() (gas: 24726561) Logs: Gas used for normal cancel 38270 Gas used for malicious cancel 24360762
From the above test we can see that a malicious user can increase the cost of cancelling a stream and make in unfavorable.
Inability to cancel stream. Loss of funds for the stream creator.
Manual
Use call and set the gaslimit within the try-catch
https://www.codehawks.com/contests/clvb9njmy00012dqjyaavpl44
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.