The withdraw
function in the SablierFlow
contract allows unauthorized parties to withdraw funds from a stream. This vulnerability arises from improper access control checks, leading to loss of funds and compromising the security of the contract.
The issue lies in the access control logic within the withdraw
function. Specifically, the condition intended to restrict withdrawals to authorized parties is not functioning correctly.
to != _ownerOf(streamId)
: Checks if the destination address (to) is not the same as the stream NFT owner (_ownerOf(streamId)
). The NFT owner is the legitimate recipient of the stream.
!_isCallerStreamRecipientOrApproved(streamId)
: Checks whether the function caller (msg.sender
) is not a stream recipient or an approved third party.
If either of the above two conditions is met, the transaction is canceled. This means that the withdrawal was not allowed because the destination address did not match or the caller did not have the proper authorization. Errors.SablierFlow_WithdrawalAddressNotRecipient
: A special error that provides information about the rejection reason, including streamId
, caller
(function caller), and to
(destination address).
The test result will show that the withdrawal to an unapproved recipient or third party was successful which should revert
with the message “SablierFlow_WithdrawalAddressNotRecipient”.
Unauthorized parties can withdraw funds, leading to direct financial loss for legitimate users.
Manual review
Foundry
Ensure that the access control logic correctly verifies the authorization of the caller.
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.