When both players commit but neither reveals their moves during a token game, the game is cancelled via _cancelGame()
which mints new tokens for both players instead of returning the originally staked tokens. This creates an economic vulnerability where players can effectively generate tokens from nothing.
In the timeoutReveal
function, when neither player reveals their move:
This calls _cancelGame
, which handles token refunds as follows:
The issue is that instead of transferring the originally staked tokens back to players, the contract mints new tokens, effectively doubling the total token supply used in the game.
This vulnerability can be systematically exploited to:
Inflate Token Supply: Players can create and join token games, commit moves, then deliberately let the reveal timeout expire to generate new tokens.
Mint Tokens Without Risk: Players can commit to multiple games, never revealing their moves, and collect newly minted tokens without ever risking their original stake.
Devalue Existing Tokens: Over time, this inflation reduces the value of legitimately earned tokens, undermining the tokenomics.
##PoC
Manual code review
Modify the _cancelGame
function to return the original tokens rather than minting new ones:
Mints new tokens upon game completion or cancellation for token-based games
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.