Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

When withdrawing funds,must ensure that streamId is not void

Summary

When withdrawing funds,must ensure that streamId is not void

Vulnerability Details

https://github.com/Cyfrin/2024-10-sablier/blob/main/src/SablierFlow.sol#L418-L427

https://github.com/Cyfrin/2024-10-sablier/blob/main/src/SablierFlow.sol#L435-L443

function withdraw(
uint256 streamId,
address to,
uint128 amount
)
external
override
noDelegateCall
notNull(streamId)
updateMetadata(streamId)
returns (uint128 withdrawnAmount, uint128 protocolFeeAmount)
function withdrawMax(
uint256 streamId,
address to
)
external
override
noDelegateCall
notNull(streamId)
updateMetadata(streamId)

In contract design, voided usually means that the process has been terminated and any related operations (such as withdrawals) are no longer allowed. Other functions have this restriction, and the withdraw and withdrawMax functions should also pass the notVoided restriction. The withdrawal function can be consistent with the overall business logic of the contract.

Impact

• Risk: A voided stream usually means that the stream has been canceled or is no longer valid, and the funds should be frozen or cleared. Without the notVoided modifier, users may continue to withdraw funds from voided streams.

Tools Used

Manual review

Recommendations

To fix this, you can add the notVoided modifier to the withdrawal function to check if the stream is valid before performing the withdrawal. This fix ensures that all streams must be in a valid state before a withdrawal operation is allowed.

function withdraw(
uint256 streamId,
address to,
uint128 amount
)
external
override
noDelegateCall
notNull(streamId)
notVoided(streamId)
updateMetadata(streamId)
function withdrawMax(
uint256 streamId,
address to
)
external
override
noDelegateCall
notNull(streamId)
notVoided(streamId)
updateMetadata(streamId)
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.