Eggstravaganza

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

Weak randomness in `EggHuntGame::searchForEgg()` allows users to influence or predict the random number or if they are going to win.

Summary

Hashing `msg.sender`, `block.timestamp`, and `block.prevrandao` together creates a predictable number.A predictable number is not a good random number.
This implementation remains vulnerable to manipulation in production environments.

Impact

Attackers can predict future "random" numbers by monitoring public blockchain data and time transactions to influence outcomes.

Scenario

1. Validators can know ahead of time `block.timestamp` and `block.difficulty` and use that to predict when/how to participate.
2. User can mine/manipulate their `msg.sender` value to result in their address being used to generate the winner!
3. Users can revert their `searchForEgg()` transaction if they don't like the outcome or if they know they will fail.

Recommendations

There are some better way to generate random numbers like:
The chainlink VRF for randomness implementation. [See in https://docs.chain.link/vrf]
Updates

Lead Judging Commences

m3dython Lead Judge 8 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.

Give us feedback!