Possible reentrancy attack in selectWinner() function
The selectWinner() function in the original smart contract is vulnerable to a reentrancy attack because it makes an external call to transfer the prize pool to the winner's address before it updates the state of the contract. If the winner's address is a contract, it could potentially call back into the selectWinner() function before it's finished, leading to a reentrancy attack.
Foundry, PhindAI, Remix
The state changes (updating the players, raffleStartTime, and previousWinner variables and deleting the players array) should be made before the external call to transfer the prize pool to the winner's address. This ensures that even if the winner's address is a malicious contract that calls back into the selectWinner() function, it won't be able to manipulate the state of the contract.
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.