Description:
The searchForEgg() function in the EggHuntGame contract uses msg.sender, block.timestamp, block.prevrandao and eggCounter to generate randomness for determining the outcome of an egg hunt. These values are predictable and can be manipulated by miners, leading to potential exploitation.
Impact:
High - Weak randomness can be exploited by malicious actors to predict or manipulate the outcome of the egg hunt, compromising the fairness and integrity of the game.
Proof of Concept:
Validators can know ahead of time the outcome of the searchForEgg() function by manipulating the block timestamp or prevrandao value. This predictability allows them to exploit the randomness mechanism to their advantage, undermining the fairness of the game.
Recommended Mitigation:
Replace the weak randomness with a secure source of randomness, such as Chainlink VRF. For example:
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.