Vulnerability Details
The contract does not enforce a deadline for the commit phase in any game turn. This means players can indefinitely delay the game by simply refusing to commit their moves. While a deadline and timeout function exist for the reveal phase, there’s no such mechanism for the commit phase.
Bug Description
Games can get stuck forever in the commit phase if one player chooses not to act. Since the contract does not track a commit deadline or offer a timeout mechanism, it cannot recover from this situation, effectively locking the game and the staked tokens inside.
Two players initiate a game (e.g., a 3-turn game). Tokens or ETH are staked, and the first turn begins.
Player A commits their move.
Player B never commits.
The game is now stuck in the Committed
state.
There is no deadline forcing Player B to act.
No one can progress or withdraw.
Even if an earlier turn somehow completes:
The next turn also enters a Committed
state.
A player can once again refuse to commit, repeating the stall indefinitely.
The Game
struct tracks a revealDeadline
, but it lacks a commitDeadline
:
While a timeoutReveal()
function exists to handle timeouts during the reveal phase, there is no equivalent for the commit phase.
Impact
** Locked Funds**: ETH or tokens staked by both players get stuck in the contract.
** Denial-of-Service**: Malicious players can harass opponents by freezing games on purpose.
** Frustrated Users**: Legitimate players cannot complete or exit their games, leading to a poor experience.
Tools Used
Manual Review
Recommended Mitigation Steps
Track a commitDeadline
in the Game
struct:
Set the commitDeadline
whenever a new turn begins (or when a game is created).
Add a timeoutCommit()
function to allow the other player to forfeit the game if their opponent doesn't commit before the deadline.
Ensure both revealDeadline
and commitDeadline
are strictly enforced with reasonable timeout windows.
Proof of Concept
Player A and Player B start a 3-turn game.
In the first turn:
Player A commits their move.
Player B refuses to commit.
Since there is no commitDeadline
, the game stays stuck forever in the Committed
state.
Neither player can cancel or reclaim their staked tokens.
The game becomes unplayable.
This can be exploited repeatedly or unintentionally by disconnected or inactive players.
Protocol does not provide a way for Player B to exit a game and reclaim their stake if Player A stops participating
Protocol does not provide a way for Player B to exit a game and reclaim their stake if Player A stops participating
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.