addRandomizer() and setTokenHash() functions don't check if _collectionID
exist
#872
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
primary issue
Highest quality submission among a set of duplicates
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/NextGenCore.sol#L170-L174
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L299-L303
Vulnerability details
In 'NextGenCore.sol' contract 'addRandomizer()' function adds randomizer to a chosen
_collectioId
. The problem is that the function is missing a check if the chosen_collectionId
does exist. Same is with 'setTokenHash' inNextGenCore.sol
,RandomizerNXT
,RandomizerRNG
,RandomizerVRF
contracts.For example in 'updateCollectionInfo()' function there is a check if the
_collectionId
is created.Impact
addRandomizer() and setTokenHash() are not restricted over working with invalid
_collectionId value
meaning that they can add invalid data for non-existing_collectionId
in the protocol.Proof of Concept
Also
setTokenHash()
is used in multiple contracts likeNextGenCore.sol
,RandomizerNXT
,RandomizerRNG
,RandomizerVRF
. By not checking if the collectionId is valid this can lead to recording invalid data to the state of the contractRecommended Mitigation Steps
Add the following check in
setTokenHash()
andaddRandomizer()
functions:Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: