Skip to content

Security: Analysis mode bypasses game rules with weak validation #86

@GarrettBeatty

Description

@GarrettBeatty

Summary

The MoveCheckerDirectly and SetCurrentPlayer endpoints in analysis mode bypass normal game rules with minimal validation, potentially allowing corrupt game states.

Risk Level

MEDIUM

Details

Analysis mode allows direct checker placement and player switching, but validation is incomplete.

Current Validation Gaps

  • Checks basic point ranges (0-25)
  • Checks that source has a checker
  • Checks destination doesn't have opponent checker
  • Missing checks:
    • Total checker count per player (should be 15)
    • Valid board state integrity
    • Whether the game mode actually allows direct moves

Affected Code

  • GameHub.cs:722-758 - MoveCheckerDirectly()
  • GameHub.cs:763-793 - SetCurrentPlayer()
  • GameHub.cs:1509 - IsValidDirectMove() - incomplete validation
// Current validation is insufficient
return CountCheckers(engine, sourceColor.Value) <= 15;
// Doesn't verify both players' totals or board consistency

Recommended Fix

  1. Verify total checker count for both players after direct moves
  2. Validate board state consistency (no impossible positions)
  3. Ensure analysis mode is explicitly enabled before allowing direct moves
  4. Add board state validation method

Impact

  • Could create impossible board positions
  • May corrupt game engine state
  • Could cause crashes or undefined behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    game-featuresCore game features and rulessecuritySecurity related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions