The searchForEgg()
function uses predictable on-chain data for randomness, enabling manipulation of egg-finding outcomes.
Location: EggHuntGame.sol
, searchForEgg()
function
Code Snippet:
Predictable Inputs:
block.timestamp
: Miners/validators can manipulate this value within a small range.
block.prevrandao
: Designed to be random but still partially miner-influenceable (not fully trustless).
Deterministic Output: Combining these inputs with msg.sender
and eggCounter
creates a pseudo-random number that attackers can precompute.
A miner submits a transaction when block.prevrandao
is favorable.
A bot monitors pending transactions and front-runs the searchForEgg()
call with parameters that guarantee random < eggFindThreshold
.
Mannual review
Use Chainlink VRF (Recommended):
Pros: Provably fair, tamper-proof randomness.
Cons: Requires LINK tokens and additional setup.
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.