https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ThePredicter.sol#L64
The ThePredicter::cancelRegistration
function does not follow CEIFREI-PI principles and, as a result, enables participants to drain the contract balance.
In the ThePredicter::cancelRegistration
function, we first make an external call to the msg.sender
address, and only after making that external call, we update the playersStatus
array.
A player who has entered the prediction could have a fallback
/receive
function that calls the ThePredicter::cancelRegistration
function again and claim another refund. They could continue to cycle this until the contract balance is drained.
All fees paid by players could be stolen by a malicious participant.
To fix this, we should have the ThePredicter::cancelRegistration
function update the playersStatus
array before making the external call.
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.