There is a lack of checking the size of _tokmin and _tokmax #796
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/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L315-L322
Vulnerability details
Impact
If the input _tokmax is smaller than _tokmin, the require statement in the burnOrSwapExternalToMint function,
require(_tokenId >= burnOrSwapIds[externalCol][0] && _tokenId <= burnOrSwapIds[externalCol][1], "Token id does not match");
, will never pass.Proof of Concept
@ function initializeExternalBurnOrSwap(address _erc721Collection, uint256 _burnCollectionID, uint256 _mintCollectionID, uint256 _tokmin, uint256 _tokmax, address _burnOrSwapAddress, bool _status) public FunctionAdminRequired(this.initializeExternalBurnOrSwap.selector) {
bytes32 externalCol = keccak256(abi.encodePacked(_erc721Collection,_burnCollectionID));
require((gencore.retrievewereDataAdded(_mintCollectionID) == true), "No data");
burnExternalToMintCollections[externalCol][_mintCollectionID] = _status;
burnOrSwapAddress[externalCol] = _burnOrSwapAddress;
@ burnOrSwapIds[externalCol][0] = _tokmin;
@ burnOrSwapIds[externalCol][1] = _tokmax;
}
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L315-L322
@ require(_tokenId >= burnOrSwapIds[externalCol][0] && _tokenId <= burnOrSwapIds[externalCol][1], "Token id does not match");
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L326C1-L339C132
Tools Used
Recommended Mitigation Steps
Add the corresponding check for this condition.
Assessed type
Context
The text was updated successfully, but these errors were encountered: