When a participant drops from the raffle via the PuppyRaffle::refund function, it leaves a blank spot in the array. This affects to the winner selection as explained in following sections.
At the time of removing a participants of the PuppyRaffle::players array, it does not being handled in the proper way. It leaves a blank spot in the array and it does not reduce the length of the array.
In this way, the PuppyRaffle::enterRaffle and PuppyRaffle::refund workflow allows users to make the length of PuppyRaffle::players array all the big that they want. That is useful at the time of exploiting other vulnerabilities such as the weak RNG in the PuppyRaffle:selectWinner function. Moreover the length of that array is used to calculate the prizePool...
Markup:
Leaving blank spots in the players array leads to:
When a winner is selected it can result in the winner being the address(0) in which case the ether will dissapear.
Allowing users to modify the length of PuppyRaffle::players at no cost leads to:
More exploitability of the weak source of randomness in the PuppyRaffle:selectWinner function.
The prizePool can be incremented as much as the attacker wants, as long as PuppyRaffle has sufficient funds.
Foundry
Handle participants' drop in a propper, and using an uint to keep track of the number of participants. For example:
If these changes are made, the PuppyRaffle code will have to be heavily refactored, which its necessary...
Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High
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.