-
Notifications
You must be signed in to change notification settings - Fork 3
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
Insufficient check are made in the setCollectionPhases
function, which could lead to unusable collections
#588
Comments
141345 marked the issue as duplicate of #1274 |
141345 marked the issue as not a duplicate |
141345 marked the issue as duplicate of #478 |
alex-ppg marked the issue as not a duplicate |
alex-ppg marked the issue as duplicate of #2033 |
alex-ppg marked the issue as selected for report |
The Warden has described all potential scenarios that would fail if the time stamps have been misconfigured for a collection and has described it in great detail. The main issue I observe is that the collection can be simply reconfigured to rectify the issue, meaning that a QA severity is better suited than a Medium severity. I invite the wardens of this and all duplicate exhibits to elaborate on a potential attack path based on this misconfiguration (i.e. loss of funds, unauthorized access to sale type) to upgrade its severity. |
alex-ppg changed the severity to QA (Quality Assurance) |
alex-ppg marked the issue as grade-a |
alex-ppg marked the issue as grade-b |
alex-ppg marked the issue as not selected for report |
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L170-L177
Vulnerability details
Impact
No check is being performed on the different parameters of a
collection
upon creation in thesetCollectionPhases
function.This means collection with wrong parameters can be created and be potentially unusable, polluting the
MinterContract
.For such collections, most of the core functions of the contract would be unusable. However this vulnerability is only marked as MEDIUM as the
setCollectionPhases
function can only be called by thecollection admin
, who can call it several time and fix the errors.Proof of Concept
Let’s have a look at the
setCollectionPhases
function belowWe can imagine a range of scenarios for a caller to create dysfunctional collections, among which:
if
_allowlistEndTime < _allowlistStartTime
and_publicEndTime < _publicStartTime
, the functionsburnOrSwapExternalToMint
andburnToMint
will always revert.if
_publicEndTime < _allowlistStartTime
andcollectionPhases[_collectionId].salesOption == 2)
, thegetPrice
function will return a fixed price even though the descending scale is set as exponentialif
_allowlistStartTime < collectionPhases[_collectionID].timePeriod
, themintAndAuction
and themint
functions will revert iflastMintDate[_collectionID] == 0
ascollectionPhases[col].allowlistStartTime - collectionPhases[col].timePeriod
would underflow.Tools Used
Manual Review / Visual Studio
Recommended Mitigation Steps
An easy fix would be to add a list of checks in the
setCollectionPhases
function using multiplerequire
statements as per below.This would prevent all the scenarios listed above and ensure the contract does not get polluted with odd collections.
We should also ensure that the
setCollectionCosts
function cannot be called again after setting the phases, meaning we should add arequire
statement like sorequire(setMintingCosts[_collectionID] == true, "Set Minting Costs");
in thesetCollectionCosts
.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: