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

PuppyRaffle::`selectWinner()` - L128-L129: Increasing Randomness in Winner Selection for Improved Fairness.

Summary

PuppyRaffle::selectWinner() - L128-L129: Increasing Randomness in Winner Selection for Improved Fairness.

Vulnerability Details

The PuppyRaffle contract currently employs a method of selecting a winner based on a hash of on-chain data, which combines the sender's address, block timestamp, and block difficulty. While this method provides a degree of randomness, it lacks the level of verifiability and transparency that can be achieved with Chainlink VRF (Verifiable Random Function). Chainlink VRF is a secure and decentralized solution that offers provably random and verifiable outcomes, enhancing the fairness and trustworthiness of the winner selection process.

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

Impact

LOW.

Tools Used

VSC.

Recommendations

To enhance the current raffle winner selection method, consider adding msg.sender nonces for improved randomness. However, for a more secure, transparent, and trustworthy solution, opt for Chainlink VRF. Chainlink VRF provides provably random and verifiable outcomes, ensuring fairness, security, and user trust.

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.