Rock Paper Scissors

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

M-02. [M-2] Denial of Service (DOS) via Block Gas Limit

Summary

Games with a large number of turns could potentially hit the block gas limit during the commit-reveal phases, thereby making the game unplayable.

Vulnerability Details

Proof of Concept

function testGasLimitDoS() public {
// Create game with extremely large number of turns
// This will cause out-of-gas errors when processing turns
vm.prank(playerA);
gameId = game.createGameWithEth{value: BET_AMOUNT}(
type(uint256).max,
TIMEOUT
);
}

Impact

An attacker can create games with an extreme high number of turns, thereby rendering the contract unusable or funds to be locked.

Tools Used

  1. Foundry

  2. VS Code

Recommendations

  1. Implement a reasonable upper limit on the number of turns.

  2. Add a gas limit check in the createGameWithEth function.

  3. Lastly, you should consider gas usage when creating a multi-turn game.

Updates

Appeal created

m3dython Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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