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

No randomness

Summary

There is no randomness in selecting the winner.

Vulnerability Details

In selectWinner function at line139
uint256 rarity = uint256(keccak256(abi.encodePacked(msg.sender, block.difficulty))) % 100;
The block.difficulty will not be changing in Proof of stake. So there won't be any randomness.

Impact

The winner can be predicted earlier.

Tools Used

Foundry
Git
Manual review

Recommendations

Avoid using static or predictable variables in generating random values.

Updates

Lead Judging Commences

patrickalphac Lead Judge almost 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.