Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Weak randomness in `EggHuntGame::searchForEgg` allows for users to influence or predict the number to find an egg

Description: Hashing msg.sender, block.timestamp, block.prevrandao and EggHuntGame::eggCounter creates a predictable number. A predictable number is not a good random number. It can be exploited by users by manipulating the numbers or knowing ahead of time to choose when to search for an egg.

Impact: Any users can influence or predict the winning number to find an egg and mint an NFT, making the chance of finding an egg useless.

Proof of Concept:

  1. Validators can know ahead of time the block.timestamp and use it to predict when to search for an egg.

  2. Users can mine/manipulate their msg.sender value.

Using on-chain values as a randomness seed is a well-documented attack vector in the blockchain space.

Recommended Mitigation: Consider using a cryptographically provable number generator such as Chainlink VRF.

Updates

Lead Judging Commences

m3dython Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Insecure Randomness

Insecure methods to generate pseudo-random numbers

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.