The selectWinner function can be exploited by an attacker using the winnerIndex randomness logic to call the function when the predicted winner index will be their index in the array.
When I call the selectWinner function after correctly predicting what the outcome player index will be, I essentially end up gaming the system by only calling the selectWinner function when the index will be my player index which I can get through the getActivePlayerIndex. So the attack path for this is to deploy my exploit contract, predict the randomness to match a result that's my player index, and then call the selectWinner function. The extra block.timestamp and block.difficulty addition to essentially making it more random won't do much to hinder accurate predictability for this attack.
Manual review
One way and probably the best to prevent this is using the Chainlink VRF function to get a random number rather than doing it manually in the PuppyRaffle::selectWinner function.
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.