The EggHuntGame::searchForEgg function uses predictable on-chain data for randomness generation, allowing miners and users to manipulate or predict egg-finding outcomes.
The contract generates randomness using block variables and user-controlled data:
This randomness implementation has several critical flaws:
block.timestamp and block.prevrandao can be influenced by miners
msg.sender is controlled by the user
eggCounter is predictable as it's a public state variable
The comment "for demonstration purposes only" acknowledges the weakness
Miners can manipulate block variables to increase their chances of finding eggs
Users can predict outcomes and only execute transactions when they know they'll find an egg
Players with technical knowledge have an unfair advantage
The core game mechanic is compromised, undermining the entire gameplay experience
If eggs have economic value, this becomes a financial vulnerability
Manual code review
Use 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.