playerB
can call RockPaperScissors::joinGameWithEth
with 0 ETH to join a game created by playerA
using RockPaperScissors::createGameWithToken
.
This results in playerB
paying no token or ETH, but still able to participate and possibly win a game with a token prize.
The issue is caused by a lack of access control in the joinGameWithETH
function, which only requires msg.value
to be equal to the bet amount in ETH (0 for a token game).
Both players can participate in a game equally with only one of them paying their bet, making the game unfair.
The following test proves that playerA
can create a token game and playerB
can join with 0 ETH:
RockPaperScissors::joinGameWithEth
should not be allowed to be called with 0 ETH. Alternatively, a new variable within the RockPaperScissors::Game
struct could be used to differentiate between token and ETH games.
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.