Potential Hash Collision in StreamFactory.salt and StreamFactory.encodeData
Summary
There is a potential hash collision in the two functions, encodeData() and salt() because of the usage of same datatype in abi.encodePacked.
Vulnerability Detail
In StreamFactory.encodeData, abi.encodePacked hashes 6 parameters together with address(this). Of the parameters, 3 are address type and 3 are uint256 type. In the code itself, payer, recipient and address(this) are next to each other, and startTime and stopTime are next to each other. When data of the same datatype are hashed together and they are next to each other, there exist a hash collision and the data may not be uniquely encoded. The problem also reside in salt() whereby msgSender, payer, recipient are grouped together and startTime, stopTime is grouped together.
peanuts
medium
Potential Hash Collision in StreamFactory.salt and StreamFactory.encodeData
Summary
There is a potential hash collision in the two functions, encodeData() and salt() because of the usage of same datatype in abi.encodePacked.
Vulnerability Detail
In StreamFactory.encodeData, abi.encodePacked hashes 6 parameters together with address(this). Of the parameters, 3 are address type and 3 are uint256 type. In the code itself, payer, recipient and address(this) are next to each other, and startTime and stopTime are next to each other. When data of the same datatype are hashed together and they are next to each other, there exist a hash collision and the data may not be uniquely encoded. The problem also reside in salt() whereby msgSender, payer, recipient are grouped together and startTime, stopTime is grouped together.
Impact
Hash collision in encoded data.
Code Snippet
https://github.com/sherlock-audit/2022-11-nounsdao/blob/main/src/StreamFactory.sol#L294
https://github.com/sherlock-audit/2022-11-nounsdao/blob/main/src/StreamFactory.sol#L315
Tool used
Manual Review
Recommendation
Consider spacing out the data with different datatype between each other so that hash collision will not exist.