Eggstravaganza

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

Weak Randomness in `random` value generated inside EggHuntGame::searchForEgg, allows anyone to find eggs very quickly

Summary

Hashing msg.sender, block.timestamp, block.prevrandao together creates a predictable final number. A predictable number is not a good random number.

Vulnerability Details

Validators can know ahead of time the block.timestamp and block.prevrandao and use that knowledge to predict when / how to participate. See the solidity blog on prevrando here.

Impact

Malicious users can manipulate these values or know them in advance to find the eggs.

Tools Used

  1. Foundry

  2. Aderyn

  3. Slither

Recommendations

Consider using an oracle for your randomness like Chainlink VRF.

Updates

Lead Judging Commences

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