The ThePredicter:cancelRegistration function is reentrant, causing loss of funds.
The ThePredicter:cancelRegistration function makes a low level call to transfer the entranceFee back to the user which the msg.sender before changing the user state to State.Cancelled. If the user is a malicious contract, it can recall the ThePredicter:cancelRegistration function thereby draining the contract.
Proof of Concepts
Add this code to the ThePredicter.test.sol file and test.
This leads to loss of funds cause the user can reenter the function and drain the contract of all the funds.
Foundry
Change the user state before making the call to transfer funds to the user.
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.