Egg NFTs are intended to be awarded to players randomly when they call the searchForEgg
function. However, the psuedo-random number is generated using predictable values that can let a player always mint an NFT.
In EggHuntGame.sol
,
the code uses block.timestamp
, block.prevrandao
, msg.sender
and eggCounter
as sources of randomness to determine minting an egg NFT. These are values that can be easily controlled/manipulated by a player to ensure the generated value is less than eggFindThreshold
.
Malicious players are able to reliably mint NFTs, which breaks the intent of the protocol and results in unfair asset earnings.
Manual Review
Aderyn
The use of keccak256 hash functions on predictable values like block.timestamp, block.number, or similar data, including modulo operations on these values, should be avoided for generating randomness, as they are easily predictable and manipulable. The PREVRANDAO
opcode also should not be used as a source of randomness. Instead, utilize Chainlink VRF for cryptographically secure and provably random values to ensure protocol integrity.
Insecure methods to generate pseudo-random numbers
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.