Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The setCollectionPhases function is missing validations for StartTime and EndTime #1942

Closed
c4-submissions opened this issue Nov 13, 2023 · 5 comments
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

Comments

@c4-submissions
Copy link
Contributor

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 the MinterContract.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. If startTime > endTime or startTime < 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:

require(_publicStartTime <= (_publicEndTime && (_publicStartTime >= block.timestamp, "wrong allowlist time")

require(_allowlistStartTime <= _allowlistEndTime && _allowlistStartTime >= block.timestamp, "wrong allowlist time")

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

@c4-submissions c4-submissions added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 13, 2023
c4-submissions added a commit that referenced this issue Nov 13, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #478

@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as not a duplicate

@c4-judge c4-judge reopened this Dec 1, 2023
@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as duplicate of #2033

@c4-judge c4-judge closed this as completed Dec 1, 2023
@c4-judge c4-judge added duplicate-2033 duplicate-588 downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed duplicate-2033 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Dec 1, 2023
@c4-judge
Copy link

c4-judge commented Dec 4, 2023

alex-ppg changed the severity to QA (Quality Assurance)

@c4-judge c4-judge added grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Dec 8, 2023
@c4-judge
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as grade-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants