In PuppyRaffle::refund, native ETH is sent to the player using using the sendValue function from the Address lib from openZeppelin. The problem here lies in the fact that it sends the native ETH value using the low-level call so all gas is forwarded to receiver before the state is updated.
A malicious player can enter the reffle using a contract rather than an EOA and decide to get out using the refund function but since it is a contract, it can run arbitrary code in either the receive or fallback functions in the receiving contract when the native ETH is sent and it provides an opportunity for reentrancy which can lead to the contract getting drained of all the funds.
PuppyRaffleTest.t.solManual review & Foundry.
Checks-Effects-Interactions pattern as recommended by the official solidity docs here should be followed.
Use the ReentrancyGuard Library from OpenZeppelin.
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.