Description: The _cancelGame()
function mints WinningTokens
back to playerA
and playerB
in a token-based game. However, these tokens are not transferred back from contract custody — they are freshly minted, regardless of whether players had already deposited 1 token each when entering the game.
Impact: A malicious user can grief the protocol by using two wallets to repeatedly create and cancel token-based games, triggering the minting of two new WinningTokens each time. Since deposited tokens aren't returned but freshly minted, this leads to unbounded inflation, undermining WinningToken’s value as a proof of victory.
Proof of Concept: Run the following test in RockPaperScissorsTest.t.sol
...
Recommended Mitigation:
Instead of minting new tokens on game cancellation, the contract should return the originally deposited tokens using transfer() from its own balance. This ensures no inflation occurs and preserves the integrity of WinningToken as a reward.
Mints new tokens upon game completion or cancellation for token-based games
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.