The PuppyRaffle::selectWinner function to choose the winner generates a random number using the block data (block.timestamp and block.difficulty). This technique is not safe.
The PuppyRaffle::selectWinner function calculates the value of winnerIndex via block.timestamp and block.difficulty.
The same method is also used to calculate the rarity of the NFT to be mined.
Using block data to generate random numbers in Solidity can be risky and potentially vulnerable to miner manipulation or front-running attacks. This is because the block value can be influenced or known by transaction participants.
The impact is high because an attacker exploiting this vulnerability could win every match.
Foundry
Manual check
To generate random numbers more securely in Solidity, it is recommended that you use external entropy sources or trusted random number generation contracts, such as the Chainlink VRF random number generator.
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.