The function EggHuntGame::searchForEgg utilizes a pseudo-random number generator that relies on ascertainable data; block.timestamp, block.prevrandao, msg.sender and EggHuntGame::eggCounter - leaving the protocol open to exploitation to guarantee eggs.
To determine whether a Player will find an egg, the EggHuntGame::searchForEgg function implements the following logic:
As this information is ascertainable by any Player, they can simply call the function when they are guaranteed success. For example, a contract designed to exploit this vulnerability:
This vulnerability has a direct impact on the main functionality of the protocol, removing the chance of Player failure.
Manual review.
It is recommended that any randomly generated values are implemented using an oracle service such as Chainlink VRF.
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.