The EggHuntGame::searchForEgg function has no rate limiting or transaction-level protection, allowing attackers to make multiple attempts in a single transaction until they successfully find an egg, completely bypassing the intended randomness mechanism.
The vulnerability exists in the searchForEgg function which has no protection against being called multiple times in a single transaction:
An attacker can create a contract that calls this function multiple times in a loop until an egg is found. With each attempt, a new random number is generated, giving the attacker multiple chances to find an egg within a single transaction.
Attacker deploys a contract with a function that calls searchForEgg in a loop
The function continues calling searchForEgg until an egg is found
With each attempt, the probability of finding an egg increases cumulatively
With enough attempts, the attacker can virtually guarantee finding an egg regardless of how low the eggFindThreshold is set
With this attack, the probability of finding an egg approaches 100% as the number of attempts increases:
With a 20% chance per attempt: 10 attempts gives an 89% chance of success
With a 30% chance per attempt: 10 attempts gives a 97% chance of success
With a 50% chance per attempt: 10 attempts gives a 99.9% chance of success
Completely bypasses the randomness mechanism of the game
Allows attackers to guarantee finding eggs regardless of the probability threshold
Creates an unfair advantage for technical players who can exploit this vulnerability
Could lead to excessive minting of NFTs in a single transaction
Undermines the core game mechanics and intended rate limiting
Combines with the predictable randomness issue to make the game completely exploitable
Manual code review
Implement a cooldown period between attempts for each address:
Contract lacks any cooldown mechanism, search limits, or costs in the searchForEgg() function
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.