The RNG formula implemented in the PuppyRaffle#selectWinner()
function for selecting the winner and the rarity is not following the best practices for generating random numbers on-chain causing the raffle to be corruptible.
The PuppyRaffle#selectWinner()
function is using two bad methods to calculate a random number.
In the following line of code is trying to generate a random index to select the winner but the tree values used for the hash msg.sender
, block.timestamp
and block.difficulty
are all visible for the public and can be easily obtained and tried being the PuppyRaffle#selectWinner()
callable by anyone being external
Same thing also for the rarity calculation
Anyone can call the function and see if the two parameters generate the rarity wanted.
Any player can use the PuppyRaffle#selectWinner()
function predicting the outcome of the raffle making some tries until the best outcome for them is generated causing the raffle to be unfair.
Manual review.
Use Chainlink VRF to have a better RNG method and make the raffle correct.
Root cause: bad RNG Impact: manipulate winner
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.