Eggstravaganza

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

Pseudo-Randomness Manipulation in EggHuntGame

Summary

The searchForEgg function in EggHuntGame contract uses predictable on-chain data for randomness, making it vulnerable to miner manipulation.

Vulnerability Details

The problematic randomness generation:

uint256 random = uint256(
keccak256(abi.encodePacked(block.timestamp, block.prevrandao, msg.sender, eggCounter))
) % 100;

Miners can influence both block.timestamp and block.prevrandao, and users can front-run transactions when they see favorable outcomes.

Impact

High - Game fairness is compromised as both miners and players can manipulate outcomes.

Tools Used

Manual Review

Recommendations

Use Chainlink VRF for verifiable randomness

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.