Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

Unbounded joinTimeout

Summary

The createGameWithEth() function in the contract initializes a game's joinDeadline using block.timestamp + joinTimeout. However, the joinTimeout variable is unbounded and lacks input validation. This opens up the potential for abuse, such as games that never expire or games with deadlines far into the future, leading to storage bloat or denial-of-service conditions in game lifecycle management.

Vulnerability Details

Function:

function createGameWithEth(uint256 _totalTurns, uint256 _timeoutInterval) external payable returns (uint256)

its found in the following line:

game.joinDeadline = block.timestamp + joinTimeout;

The value of joinTimeout is used without any constraints or range checks. If this variable is:

  • Publicly modifiable

  • Unintentionally initialized to a very high value (e.g., type(uint256).max)

…it would allow a game to set a joinDeadline that is years .

This creates a logic flaw, especially if other parts of the contract rely on the joinDeadline to:

  • Allow or reject players from joining

  • Refund bets after a timeout

  • Clean up abandoned games

Without time-based expiry, such games may linger indefinitely, consuming contract storage and resources.

Impact

  • Storage Bloat: Attackers could spam the contract with games that remain active forever, leading to unnecessary storage consumption and increased gas for legitimate users.

  • Economic Lock-in: Funds placed in such games may become inaccessible if no timeout ever occurs.

Tools Used

Manual code review

Recommendations

Validate the joinTimeout value: Add an upper and lower bound to ensure reasonable deadline values:

require(joinTimeout >= 5 minutes && joinTimeout <= 1 days, "Join timeout out of range")
Updates

Appeal created

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Owner is Trusted

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Owner is Trusted

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.