Opponents could join for free games created with tokens
The following function RockPaperScissors::joinGameWithEth() implements the conditions required a potential opponent to join games, created with ETH bets. Though missing a critical check for msg.value amount could drive to incompatible with the protocol flow behavior - join for free games, created with tokens. When a player creates a game with tokens we have zero amount of ETH (game.bet = 0). So if the opponent or malicious user just calls the function RockPaperScissors::joinGameWithEth() with no ETH, it will fullfil the requirements and pass the validation, successfully entering the game. The only important requirement for the opponent is to have at least 1 winner token.
Мissing required check leads to:
incompatible with protocol flow behavior
join for free games created with ETH bets
not charged even with tokens
potencially win more tokens
Manual review
Foundry
Add the following test to RockPaperScissors.t.sol.
Add the following check to RockPaperScissors::joinGameWithEth()
joinGameWithEth function lacks a check to verify the game was created with ETH
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.