Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Inconsistent Game Type Enforcement in Join Functions

Inconsistent Game Type Enforcement in Join Functions

Summary

The contract fails to explicitly validate game types during player joins, relying solely on implicit bet amount checks. This could allow mismatched joins under specific conditions.

Vulnerability Details

Location:

joinGameWithEth()

joinGameWithToken()

Current Implementation Issues:

Token games identified only by game.bet == 0

No positive validation of intended game type

Exploitable Scenario:

// Step 1: Create ambiguous game
createGameWithEth(bet: 0) // Possible through error or malice
// Step 2: Both join methods now valid
joinGameWithEth(bet: 0) // ETH join with 0 value
joinGameWithToken() // Token join also possible

Resulting Problems:

  • Prize distribution may fail unexpectedly

  • Contract enters undefined state

  • Off-chain tracking becomes unreliable

Impact

  • Broken game state transitions

  • Incorrect prize calculations

  • Possible fund/token lockups

Tools Used

Manual code review

Recommendations

Add Explicit Game Type Tracking:

  • Implement GameType enum in storage

  • Set type during game creation

Updates

Appeal created

m3dython Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Game Staking Inconsistency

joinGameWithEth function lacks a check to verify the game was created with ETH

m3dython Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Game Staking Inconsistency

joinGameWithEth function lacks a check to verify the game was created with ETH

Support

FAQs

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