_collectionEndMintCost should be less than collectionMintCost for the getPrice function to implement salesOption2, but there is no such check #338
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-1831
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#L553
Vulnerability details
Impact
_collectionEndMintCost should be less than collectionMintCost for the getPrice function to implement salesOption2, but there is no such check. Therefore getPrice suffer potential underflow during salesOption 2, for positive rate
salesOption 2 implements some depreciating auction price, either through exponential or linear decrement.
On the case of linear decrement, the formula is as follow:
which has limited the price to be
collectionEndMintCost
. However, when we double check the collectionEndMintCost, there is no guarantee thatcollectionEndMintCost
is strictly less than thecollectionMintCost
.Impact: if the collectionEndMintCost is bigger than the collectionMintCost, and the user set salesOption2, then the auction cannot proceed since
collectionPhases[_collectionId].collectionMintCost - collectionPhases[_collectionId].collectionEndMintCost
revert.Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Recommended Mitigation Steps
Consider adds a validation check on
collectionEndMintCost <= collectionMintCost
, ifcollectionEndMintCost
is solely used for a depreciating auction; otherwise when a salesOption 2 is wanted, validate so.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: