Description:
The EggHuntGame::searchForEgg
function relies on a pseudo-randomness logic based on predictable values such as block.timestamp
, block.prevrandao
, msg.sender
, and eggCounter
. These inputs can be known or controlled by an attacker, allowing them to accurately predict the outcome of the function before execution. This breaks the intended randomness of the game and enables deterministic exploitation to collect eggs unfairly.
Impact:
The predictability of the randomness mechanism allows an attacker to collect eggs consistently and risk-free. This compromises the fairness of the game, enables automated bot exploitation, and may result in an unfair distribution of NFT rewards
. In competitive or economically valuable environments, this vulnerability can lead to financial loss, manipulation of game mechanics, and a loss of user trust.
Proof of Concept:
Result:
Recommended Mitigation:
It is strongly advised to avoid using block.prevrandao
, block.timestamp
, or any other on-chain predictable value as a randomness source for critical decisions, especially those involving rewards or NFT distribution.
Instead, consider implementing one of the following secure alternatives:
Chainlink VRF (Verifiable Random Function)
:
A widely-used, secure solution for generating truly unpredictable and verifiable randomness on-chain.
Oracles or trusted off-chain randomness providers
:
Use external services to generate randomness off-chain and submit it to the smart contract only when needed.
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.