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

Uniqueness of hash for `rarity` can be broken, could be same `msg.sender` and same block difficulty used more than once.

Summary

Uniqueness of hash for rarity can be broken, could be same msg.sender and same block difficulty used more than once.

Vulnerability Details

Impact

Effectively two or more winners could end up with the same rarity NFTs not due to random coincidence, but purely due to the bad uniqueness factor being used.

Tools Used

VSC.

Recommendations

Suggest to add additional parameters that would help increase the uniqueness factor:

uint256 rarity = uint256(keccak256(abi.encodePacked(msg.sender, block.difficulty, block.timestamp, nonce))) % 100;
Updates

Lead Judging Commences

Hamiltonite Lead Judge over 1 year 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.