-
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
Missing time period check will result in revert during minting #453
Labels
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
duplicate-1980
edited-by-warden
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Comments
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 7, 2023
code4rena-admin
changed the title
Users can mint tokens consecutively without waiting for the time period to pass
Missing time period check will result in revert during minting
Nov 7, 2023
141345 marked the issue as duplicate of #478 |
141345 marked the issue as not a duplicate |
141345 marked the issue as duplicate of #1278 |
141345 marked the issue as duplicate of #962 |
141345 marked the issue as not a duplicate |
141345 marked the issue as duplicate of #1278 |
alex-ppg marked the issue as duplicate of #1980 |
alex-ppg marked the issue as unsatisfactory: |
c4-judge
added
the
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
label
Dec 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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
duplicate-1980
edited-by-warden
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L249
Vulnerability details
In the
mint()
, if the nft is to be minted at certain intervals then the time period interval is set atcollectionPhases[col].timePeriod
.But there are possible chances that the mint function will revert because there is no check to ensure that the time period isn't set to 0 during sales option 3.
Proof of Concept
Take the following scenario:
collectionPhases[col].salesOption == 3
in this case.mint()
is executed & it entersif (collectionPhases[col].salesOption == 3)
block.tDiff = (block.timestamp - timeOfLastMint) / collectionPhases[col].timePeriod
on line 249 will revert because of division by 0 because the time period has been set to 0.Impact
Due to missing check, it is possible that minting will revert in case the time period is set to 0 during sales option 3.
Tools Used
Manual
Recommended Mitigation Steps
Add a check in the
if
block where the sales option is checked for time period to be greater than 0.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: