Summary
The createMerkleLL function lacks checks to ensure that streamDurations.total is not zero.
If streamDurations.total is zero, it becomes impossible to create the stream, as verified by the following checks:
checkCreateLockupLinear
This can lead to the creation of a non-functional SablierV2MerkleLL contract.
Vulnerability Details
https://github.com/Cyfrin/2024-05-Sablier/blob/main/v2-periphery/src/SablierV2MerkleLockupFactory.sol#L36
function createMerkleLL(
MerkleLockup.ConstructorParams memory baseParams,
ISablierV2LockupLinear lockupLinear,
LockupLinear.Durations memory streamDurations,
uint256 aggregateAmount,
uint256 recipientCount
)
external
returns (ISablierV2MerkleLL merkleLL)
{
merkleLL = new SablierV2MerkleLL(baseParams, lockupLinear, streamDurations);
emit CreateMerkleLL(merkleLL, baseParams, lockupLinear, streamDurations, aggregateAmount, recipientCount);
}
Impact
This can lead to the creation of a non-functional SablierV2MerkleLL contract.
Tools Used
Manual
Recommendations
It's recommended to add the validation for the streamDurations when creating the SablierV2MerkleLL contract.
function createMerkleLL(
MerkleLockup.ConstructorParams memory baseParams,
ISablierV2LockupLinear lockupLinear,
LockupLinear.Durations memory streamDurations,
uint256 aggregateAmount,
uint256 recipientCount
)
external
returns (ISablierV2MerkleLL merkleLL)
{
// Deploy the MerkleLockup contract with CREATE.
+ require(streamDurations.total > 0);
merkleLL = new SablierV2MerkleLL(baseParams, lockupLinear, streamDurations);
// Log the creation of the MerkleLockup contract, including some metadata that is not stored on-chain.
emit CreateMerkleLL(merkleLL, baseParams, lockupLinear, streamDurations, aggregateAmount, recipientCount);
}