withdrawWinnings()
function does not follow the CEI pattern
The Game::withdrawWinnings()
function, which implements the mechanism allowing regular players to withdraw their prize, does not follow the Checks-Effects-Interactions (CEI) pattern. The reason is that the contract’s state is updated only after the funds have been transferred to the player’s account. This behavior is incompatible with CEI and does not meet the requirements defined by the pattern. This makes the logic vulnerable and renders the function fragile, with the only reason it is not susceptible to reentrancy attacks being the presence of the nonReentrant
modifier.
Likelihood: Low
Impact:
N/A
Manual review
Update function withdrawWinnings()
as follows:
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.