refund()
is designed to refund the entranceFee to a user who chooses not to participate in the raffle. However, it fails to adhere to the recommended checks-effects-interactions pattern, which creates a potential vulnerability to reentrancy attack.
refund()
sends the entranceFee (in ether) back to the user. However, it exhibits a vulnerability where it first transfers the funds and then updates the players array to the zero address. This sequence allows an attacker to create and malicious smart contract using the receive()
function to re-enter the contract and execute the refund()
function again, potentially draining the contract's entire balance.
All the founds can be stolen.
Manual review.
Follow the checks effects interactions pattern, first actualize the players array to zero address and next sends the entranceFee to the user.
reentrancy in refund() function
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.