The _cancelGame
function contains a logic flaw where it transfers ETH to playerA
without validating that the address is not zero. This creates a critical edge case where, if playerA
is address(0)
, the contract will send ETH to an unrecoverable address, resulting in permanent fund loss. A simple check for address(0)
before refunding would mitigate this issue.
When a game is canceled, the contract refunds ETH to both playerA
and playerB
. The code checks if playerB
is not the zero address before processing the transfer, but no such check exists for playerA
:
If game.playerA
is ever address(0)
(e.g., due to an error in game creation or a malicious interaction), ETH will be sent to the zero address, resulting in irreversible loss.
Loss of funds due to sending ETH to address(0)
Could be exploited or triggered unintentionally
Damages user trust and affects contract integrity
Manual Review
Before making the refund to playerA
, add a check similar to playerB
:
Code suggestions or observations that do not pose a direct security risk.
Code suggestions or observations that do not pose a direct security risk.
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.