The SablierV2Lockup.sol:withdrawMaxAndTransfer
function requires the caller to be the recipient. This requirement is unnecessary because an approved user can perform the withdraw the max amount from the stream And transfer the NFT in a step-by-step process to implementing the same function. So there is no need to require the caller of the withdrawMaxAndTransfer
must be the user of stream's recipient.
In the v2-core/src/abstracts/SablierV2Lockup.sol:withdrawMaxAndTransfer
function documentation, it states that msg.sender must be the stream's recipient. This restriction is too strict. In reality, msg.sender
can be either the recipient or an authorized user of the recipient to perform this function.
The function's purpose is: Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the NFT to newRecipient
.
However, in practice, if the stream's recipient is Alice and Alice has authorized Bob to access the stream, then Bob can withdraw the stream to the newRecipient and also transfer the NFT of the stream ID. Therefore, there is no necessity to restrict caller si Alice, because Bob CAN perform the same thing.
https://github.com/Cyfrin/2024-05-Sablier/blob/43d7e752a68bba2a1d73d3d6466c3059079ed0c6/v2-core/src/abstracts/SablierV2Lockup.sol#L409-L433
It is useless and misleading to require the caller is stream's recipient, but it should also work for approved users.
Manual Review
Change the validation logic for msg.sender
to _isCallerStreamRecipientOrApproved
.
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
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.