The setCollectionPhases function is missing validations for StartTime and EndTime #1942
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-588
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#L170-L177
Vulnerability details
Impact
The Collection Phases timings can be mistakenly or maliciously set to incorrect timestamps, potentially preventing users' participation in the sale phases.
Proof of Concept
The
setCollectionPhases
function in theMinterContract.sol
contract enables a collection admin to define sale phases for a_collectionId
, setting parameters such as_allowlistStartTime
,_allowlistEndTime
,_publicStartTime
, and_publicEndTime
.However, there is currently no validation check to ensure that
_allowlistEndTime > _allowlistStartTime
and_publicEndTime > _publicStartTime
. This absence of validation allows the collection admin to unintentionally or intentionally (maliciously) input invalid values, potentially preventing a sale from occurring.Furthermore, there is no verification that
_publicStartTime >= block.timestamp
and_allowlistStartTime >= block.timestamp
. IfstartTime > endTime
orstartTime < block.timestamp
, the sale would be rendered unable to start, impeding users from minting tokens.Tools Used
VSCode
Recommended Mitigation Steps
Add the following require statements to the setCollectionPhases() function:
These statements ensure that the specified start and end times for both public and allowlist sales are valid, preventing incorrect configurations that could impact the sale phases.
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: