Rock Paper Scissors

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

Invalid Enum Values Accepted in Move Input

Summary

Solidity enums default to uint8, and unchecked input values can cast to invalid enum states.

Vulnerability Details

enum Move { Rock, Paper, Scissors }
function playMove(Move move) external {
// No validation of move value
}

This allows casting of invalid values like 3, 4, 255 to undefined states, which can break logic or force undefined behavior in comparisons.

Impact

  • Denial of service

  • Inconsistent game outcomes

Tools Used

  • Manual review

  • Fuzz testing

Recommendations

Validate input before casting:

function playMove(uint8 _move) public {
require(_move <= 2, "Invalid move");
Move move = Move(_move);
}
Updates

Appeal created

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

Support

FAQs

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