This is dangerous in scam senario because the malicious user can frontrun and become the owner of the collection. As owner, one can withdraw paymentToken. (note that _collections.isForSale can be change by frontrunner)
function createProject(
string memory _projectId,
Collection[] memory _collections
) external onlyAvailableProject(_projectId) {
require(
_collections.length > 0,
'CoreFactory: should have more at least one collection'
);
Lines of code
https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L70-L77
Vulnerability details
Impact
This is dangerous in scam senario because the malicious user can frontrun and become the owner of the collection. As owner, one can withdraw
paymentToken
. (note that _collections.isForSale can be change by frontrunner)Proof of Concept
createProject
.https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L70-L77
Recommended Mitigation Steps
Two way to mitigate.
msg.sender
. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol#L102