-
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
minting of new tokens prevented with timePeriod of zero #243
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
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 3, 2023
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 |
c4-judge
added
duplicate-1980
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
and removed
duplicate-1278
labels
Dec 6, 2023
alex-ppg marked the issue as unsatisfactory: |
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
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#L249
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L292
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L546
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L551
Vulnerability details
Impact
When the
timePeriod
incollectionPhases
is set to zero (as it is innextGen.test.js
and as it is described in the documentation), several functionscan revert due to divide by zero errors. These functions include,
mintToAuction
:This results in not being able to mint tokens for an auction.
Additional functions fail to function correctly depending on the collection phase and rate.
getPrice
:and then in
mint
:Proof of Concept
Testing with the following parameters from
nextGen.test.js
result in a revert when trying to mint a token for an auction:Tools Used
VScode. Foundry
Recommended Mitigation Steps
setCollectionCosts
, if_salesOption
is not equal to 1, then enforce a non-zerotimePeriod
. This fixesgetPrice()
andmint
.mintAndAuction
, ifsalesOption!=3
, then don't calculatetDIff
. This is the onlysalesOption
wheretimePeriod
can be zero, but thentDiff
isn't applicable.The below diff fixes the issue:
Assessed type
Math
The text was updated successfully, but these errors were encountered: