The `searchForEgg` function in `EggHuntGame.sol` uses a pseudo-random number generation method that includes `block.timestamp`, making the outcome potentially predictable and exploitable.
The searchForEgg
function generates a random number using keccak256(abi.encodePacked(block.timestamp, block.prevrandao, msg.sender, eggCounter)) % 100
.
While `block.prevrandao` offers some randomness, the inclusion of `block.timestamp` introduces a degree of predictability, especially within short timeframes.
players might be able to strategically time their `searchForEgg` transactions based on the current `block.timestamp` to increase their chances of finding an egg. This can lead to an unfair advantage over other participants in the game.
For secure and unbiased random number generation on-chain, it's advisable to use external oracles, verifiable off-chain computations, or cryptographic methods that are less susceptible to manipulation.
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.