The PuppyRaffle::winnerIndex
variable does not select a truly random winner. Off-chain solutions are recommended.
The PuppyRaffle::winnerIndex
variable selects a random winner index by using an onchain randomizing method. This method can be used by an attacker to theoretically select a specific winner by manipulating msg.sender, block.timestamp, block.difficulty parameters. On top of that, this function does not have an access controller which allows an attacker to attack.
Here is my PoC that shows an attacker can call the selectWinner function
Manual Analysis
1 - Use an acess controller on selectWinner function.
2 - Use off-chain solutions to achieve true random values.(Ex. Chainlink VRF)
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.