The function joinGameWithToken()
allows a player to join a non-existent game, since there is no check for whether the specified gameId
actually maps to a created game.
Accessing games[_gameId]
on an uninitialized mapping entry returns a default struct. If playerA
is address(0)
, this is likely an invalid game. However, the function continues assuming the game exists, allowing a player to join and triggering side effects like token transfers.
Game integrity violated
Players can join games that were never created
Manual code review
Add a guard to verify the game exists:
This should be placed after fetching the game struct but before any other logic.
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.