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

Use of block.timestamp and block.difficulty for Randomness

Summary

The smart contract uses block.timestamp and block.difficulty as sources of randomness, which are manipulatable by miners to some extent.

Vulnerability Details

The selectWinner function uses keccak256(abi.encodePacked(msg.sender, block.timestamp, block.difficulty)) to determine the winner and the rarity of the NFT. Miners could potentially manipulate block.timestamp and block.difficulty to favor a particular outcome.

Impact

An attacker could gain an unfair advantage in the raffle, undermining the integrity of the game.

Tools Used

Manual Code Review

Recommendations

Use a more secure source of randomness like Chainlink VRF

Updates

Lead Judging Commences

Hamiltonite 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.