Description: After player1 creates a new game, player2 joins, matching the bet. Because the game state is still in the Created, another player 3 can join game. This replaces player2 and locks their funds in RockPaperScissors.sol.
Impact: Loss of funds from replaced player, funds locked in RockPaperScissors.sol. The same vulnerability is in joinGameWithToken where the replaced player could loose their WinningToken.
Proof of Concept: Run the following test in RockPaperScissorsTest.t.sol...
Player A creates game with bet
Player B joins game matching bet
Player C joins game with bet, replacing Player B
Recommended Mitigation:
Before game is joined, check if second player already exists
Add another Game status (eg: 'Pending', 'Ready') between the 'Creation' and 'Committed' phase.
Game state remains Created after a player joins
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.