Missing check in the burnToMint function if the price was already set #1016
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1866
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/hardhat/smart-contracts/MinterContract.sol#L256-L272
Vulnerability details
Summary
The burnToMint does not check if the price is already set with require(setMintingCosts[_collectionID] == true, "Set Minting Costs"); as the other mint functions do. Therefore, users are able to mint NFTs for free if price is not set yet.
Vulnerability Details
There are multiple functions to mint NFTs which correctly implement the check if the mint costs were already set:
The burnToMint function misses this check:
This allows users to mint NFTs for free between the time of setting the data for the NFT drop and setting the price, as the getPrice function call will return 0:
salesOption is not set and therefore takes the default value 0 of uin256 and therefore getPrice will return collectionMintCost which is also not set and takes the default value 0.
Impact
Users can mint NFTs for free and therefore steal funds from the artist and the protocol.
Tools Used
Manual Review
Recommendations
Check if the price was already set.
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: