NextGenRandomizerNXT uses the PREVRANDAO opcode as source of randomness #1014
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1901
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/hardhat/smart-contracts/XRandoms.sol#L35-L43
Vulnerability details
Summary
The NextGenRandomizerNXT contract uses block.prevrandao as the source of randomness this value is not truly random, and validators who are chosen to propose new blocks will be able to know the value of the PREVRANDAO opcode.
Vulnerability Details
As the NextGenRandomizerNXT uses the block.prevrandao together with deterministic things like block.number to calculate the random hash. The result of minting an NFT can be deterministically calculated by validators. This creates unfair market conditions.
Here we can see that the flow of generating a random hash with the NextGenRandomizerNXT contract uses the PREVRANDAO opcode as the source of randomness:
Impact
Validators are able to already know which NFT they would get if they mint now. This creates very unfair market conditions, as validators are able to cheat and depending on the NFT collection steal funds by doing so. It also destroys the rarity variables of the artist.
Tools Used
Manual Review
Recommendations
Do not use the PREVRANDAO opcode as a source of randomness, if the outcome of the random hash is not trivial.
Assessed type
MEV
The text was updated successfully, but these errors were encountered: