-
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
Randomness for a tokenId can be lost if RNG contract runs out of ETH or VRF subscription runs out of LINK #1307
Comments
141345 marked the issue as primary issue |
141345 marked the issue as sufficient quality report |
a2rocket (sponsor) disputed |
We are aware of this and also posted it several times on the channel as well as on the contest page. The randomizer contracts will have the funds needed. |
related to #1464 |
The Warden specifies that the Per the Sponsor throughout multiple submissions as well as the contest's Should the need arise, administrative functions are present that permit the system to "recover" from an insufficiently funded state by resetting the randomizers, re-invoking As an addendum for duplicated findings that relate to the payment being insufficient for the call, the payment can be reconfigured by the administrators of the contract and it is safe to assume that the NextGen team will maintain the oracles properly. |
alex-ppg marked the issue as unsatisfactory: |
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/RandomizerVRF.sol#L65
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/RandomizerRNG.sol#L48
Vulnerability details
Impact
The RandomizerVRF.sol and RandomizerRNG.sol contracts are used to generate randomness for each token on NextGen collections. In both these contracts, there are functions requestRandomWords() and fulfillRandomWords(). The former is called to request randomness for a token while the latter is called by the VRF or RNG service to serve the randomness, which then further calls the setTokenHash() function on the gencore contract to store the hash generated. The problem arises when the VRF or RNG service runs out of LINK in the subscription plan or ETH in the contract respectively. Due to this, the call to serve randomness to fulfillRandomWords() and setTokenHash() fails, which leads to the randomness being lost for that tokenId. The hash for the tokenId cannot be set through some other way since setTokenHash() is only callable from the Randomizer contracts, which are further only used when minting tokens in the NextGenCore.sol contract. Since the user cannot mint a token with the same tokenId again, the hash is permanently empty for that given tokenId.
Proof of Concept
Here is the process:
Tools Used
Manual Review
Recommended Mitigation Steps
If such a situation arises, make sure to store the randomness in a mapping for each tokenId for the respective collectionId.
Use the randomness stored now to set the hash of the tokenId. In order to set the tokenHash in such an emergency situation, there is no other way but to also allow the admins to call the setTokenHash() function.
Solution (change on Line 311):
Assessed type
Other
The text was updated successfully, but these errors were encountered: