Calling a hook is a well-known increase in gas usage, but it can also introduce the possibility of denying withdrawals or causing losses for users trying to withdraw their funds from the stream due to a malicious sender.
When the stream is active, users can withdraw any amount up to what has been streamed up to that point. Before the withdrawal ends, two hooks are called. The vulnerability arises in the sender
hook:
This allows the contract (if meeting the requirements) to make an external call to the sender
where any amount of gas can be used without restriction. A malicious sender can implement a function that consumes all the gas, preventing the transaction from completing.
Moreover, there is no function to change the sender once set, allowing the sender to cancel and withdraw the remaining funds, while leaving the unclaimed funds locked in the contract.
In the case of an airdrop campaign, these funds can be locked forever, potentially leading to fake campaigns where users can never withdraw their funds. These locked funds do not affect the protocol as they effectively reduce the total supply due to the inability to recover them.
Reason for a malicious sender to do this:
To trick the recipient
into providing a service without paying and then cancel the stream to recover part of the money.
The sender's contract might be unverified, allowing it to activate other functionalities at the recipient's expense.
The sender's contract could be a proxy, which can change the functionality of onLockupStreamWithdrawn
and manipulate gas usage to deceive the recipient
.
If you implement this minimal test in Remix IDE, you may encounter the error transact to Sablier.withdraw errored: estimated gas for this transaction (113203666) is higher than gasLimit set in the configuration (0x2710). Please raise the gas limit.
Recipients cannot withdraw their funds and their unclaimed asset will be stuck in the contract.
Manual code review
Set a specific gasLimit
that the sender can use, such as:
This way, the sender can perform their functionality without consuming excessive gas or denying withdrawals. Test the complexity to estimate the sender's needs.
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.