There are a few issues leading to this vulnerability. The amount of Token bet in the game wasn't declared in the Game
Struct. Also, the joinGameWithToken
function lacks proper enforcement of token betting consistency. It doesn't verify the token amount required to join a game, and it does not validate whether the joining player (Player B) stakes the same token amount as the game creator (Player A). This allows players to cheat by joining with fewer tokens than intended, leading to fund imbalance and unfair gameplay.
Within the joinGameWithToken
function, the contract allows a player to join a token-based game simply by holding and transferring 1 token:
However:
Token Bet Amount Not Declared: There is no variable storing how many tokens Player A staked when creating the game. This is unlike ETH games, where game.bet
is explicitly recorded.
Token Bet Not Matched: Player B is never required to stake the same number of tokens as Player A. A malicious user could create a game and commit more value (e.g., 100 tokens), while another player joins by transferring only 1 token, and still has equal winning power.
This inconsistency breaks the fairness of the game and could allow manipulation where:
Players risk vastly different values.
One side (e.g., Player A) can lose much more than the opponent (Player B) if they lose.
A malicious actor can repeatedly join games with minimal stake hoping to win against high-stake opponents.
This vulnerability allows unfair participation in games. Players can cheat the system by staking fewer tokens and potentially winning more than they risked. This can lead to:
Loss of player trust.
Economic imbalance in the system.
Potential token farming or abuse scenarios.
Manual Review.
Introduce a tokenBet
variable in the Game
struct to explicitly store the number of tokens staked by Player A.
In joinGameWithToken
, enforce:
Additionally, ensure that the amount transferred via transferFrom()
matches the required stake.
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.