The function ThePredicter::cancelRegistration
contains a reentrancy vulnerability. This occurs because the function makes an external call to send Ether to the caller before updating the caller's status in the playersStatus mapping.
The line (bool success, ) = msg.sender.call{value: entranceFee}(""); sends Ether to msg.sender before the status is updated to Status.Canceled. If msg.sender is a contract, it can execute a fallback or receive function that calls cancelRegistration again, exploiting the vulnerability to withdraw funds multiple times.
Manual review
Ensure you update the player's status in the playersStatus mapping before making the external call to send Ether, to mitigate this reentrancy attack. Below is the correct implementation of the function to cancelRegistration
Reentrancy of ThePredicter::cancelRegistration allows a maliciour user to drain all funds.
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.