Player can get all the balance from the contract via reentrancy in refund.
Refund function does not follow CEI pattern and also don't have ReentrancyGuard. In refund() control is transferred to recipient via sendValue function from Address library as shown below:
And the playerIndex is removed from players array only after recipient give the control back to the contract. But sendValue function does a low level call as shown below:
Hence during this call, recipient might be malicious and via fallback function it can call the return function again with the same playerIndex. Since playerIndex is still in players array, all require statements will be success and player will continue to get entranceFee from protocol until all balance zeroed out.
Stealing all funds from contract, hence high.
Manual Review
Always follow CEI pattern and/or use ReentrancyGuard modifier.
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.