Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Anyone can predict the winner and pick himself.

Summary

The function selectWinner uses:

uint256(keccak256(abi.encodePacked(msg.sender, block.timestamp, block.difficulty))) % players.length;

to pick the winner , but all of these can be predicted and used to calculate a certain winner from the array.

Vulnerability Details

Never use block.timestamp, block.difficulty etc for a source of randomness.

Impact

High

Tools Used

Manual review

Recommendations

Use Chainlink VRF

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

weak-randomness

Root cause: bad RNG Impact: manipulate winner

Support

FAQs

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

Give us feedback!