PuppyRaffle::selectWinner Violates Checks-Effects-InteractionsIn selectWinner(), the contract is designed to complete all state updates and mint the winner's NFT reward as part of the raffle finalization.
An external call winner.call{value: prizePool}("") is triggered before _safeMint(winner, tokenId). Because _safeMint makes an external callback to onERC721Received if the winner is a contract, this ordering violates the Checks-Effects-Interactions (CEI) principle and creates reentrancy exposure before the token state finishes updating.
Likelihood:
A contract address is selected as the winner, receiving execution flow during call before _safeMint is invoked.
An unexpected external call occurs during token minting via IERC721Receiver.onERC721Received.
Impact:
Violates standard CEI guidelines and opens attack surfaces for reentrancy or inconsistent state inspection during transaction execution.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.