No sanitiy check on allowlist and public phases, potential fixed price for salesOption == 2 #515
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L540
Vulnerability details
Impact
In the case where
collectionPhasesDataStructure.allowlistEndTime
is set to a value higher thancollectionPhasesDataStructure.publicEndTime
, thegetPrice
function will returncollectionPhasesDataStructure.collectionMintCost
instead of the adjusted decreasing price, resulting in an excessive cost for the NFT minter.Proof of Concept
The documentation indicates that sales models can be combined with phased allowlists to execute highly complex drops. This includes phases with one or several optional allowlist sales, as well as optional public sales.
Given the flexibility of the contract, to avoid a public sale,
setCollectionPhases
should be fed with_publicStartTime == _publicEndTime
.If
salesOption == 2
and, either by mistake or intentionally,publicEndTime
is set to a past value or simply to a value of 0, thegetPrice
function will return a fixed pricecollectionPhases[_collectionId].collectionMintCost
instead of the adjusted price for the descending sale.The
CollectionAdmin
callssetCollectionPhases
prior to minting but also for each update of themerkleRoot
, increasing the probability of human error.Tools Used
Manual Review
Recommended Mitigation Steps
Implement two distinct functions to set up Public sales (
setCollectionPhases
) and Allowlist Sales (setAllowlistPhases
) to avoid confusion, redundancy and reduce the risk of error.Add sanity checks to ensure that
collectionPhasesDataStructure.allowlistEndTime
is less than or equal tocollectionPhasesDataStructure.publicStartTime
, and thatcollectionPhasesDataStructure.publicStartTime
is less than or equal tocollectionPhasesDataStructure.publicEndTime
.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: