withdrawWinnings
function should follow CEI pattern, however it transfers ether before updating the value of pendingWinnings
to 0. This exposes the function to re-entrancy risks and is not a secure withdraw pattern as opposed to what it states in the comments
Likelihood: Low
The function is protected by a nonReentrant
modifier as well, so the risk of re-entrancy attacks are low. But the function would solely rely on the modifier for protection.
Impact: High
If the manual re-entrancy guard could be bypassed, there is a potential for the entire contract to be drained.
NA
This could be easily solved by bringing the update of pending winnings forward before the transfer call.
We only audit the current code in scope. We cannot make speculation with respect to how this codebase will evolve in the future. For now there is a nonReentrant modifier which mitigates any reentrancy. CEI is a good practice, but it's not mandatory. Informational
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.