Lack of input validation #583
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
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
sufficient quality report
This report is of sufficient quality
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#L157-L167
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L170-L177
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L319
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L320-L321
Vulnerability details
Impact
Initialization, modification functions used by admin don't have any internal validation. These may lead to protocol breaks, such as: wrong state, blocking collections and so on. Such errors may be as special, or as "fat finger" error.
Proof of Concept
Let's discuss some code parts:
Here possible problems:
collectionEndMintCost
less thancollectionMintCost
, this leads to errors during price calculation;timePeriod
can be 0, this leads to error during price calculation;salesOption
can be out of supported values (1,2,3)._tokmin
can be less than_tokmax
;_burnOrSwapAddress
can be0
, this leads to stop burnToMint process, because transfer to address 0 will be reverted.To sum up:
Better add validations for these input parameters, because it helps to prevent occasional typos on main-net.
Tools Used
Manual review
Recommended Mitigation Steps
Add validations for incoming parameters in all modification functions.
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: