The createGameWithEth function in RockPaperScissors.sol lacks an upper bound check on the _totalTurns parameter, allowing any user to create a game with an extremely high number of turns. This leads to a Denial of Service (DoS) as subsequent game phases (e.g., committing or revealing moves) will become computationally infeasible due to extreme gas consumption. This could render the game unusable or permanently stalled.
Function Affected: createGameWithEth
Line: 92 – 116
Code Location:
There are checks ensuring _totalTurns > 0 and that it is odd, but no upper bound is enforced, which allows an attacker to pass extremely high values (e.g., 2**256 - 1). This causes:
Gas-intensive storage growth (due to _totalTurns being stored and incremented during gameplay)
Unresolvable games (e.g., committing or revealing millions of turns)
Risk of failing transactions and locked funds
High gas costs for all game participants
Failure to resolve game rounds due to gas limits being exceeded
Unplayable game sessions, blocking users from recovering ETH or completing the game
Potential loss of user trust in the platform
Remix IDE
Manual Code Review
Custom Exploit Contract
Add an upper bound check for _totalTurns to limit the number of turns per game to a reasonable amount, for example:
Alternatively, use a configurable max limit that can be adjusted by an admin if needed:
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.