Skip to content

Critical DoS: malformed input dereference in run_game action dispatch #477

@eldraco

Description

@eldraco

🐛 Bug Report

Past Issues Searched

  • I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • This is a bug report and not a feature request, nor asking for support

Describe the bug

AIDojoCoordinator/coordinator.py contains a critical unauthenticated DoS in run_game().

At [AIDojoCoordinator/coordinator.py:422] parsing is attempted via Action.from_json(message). If parsing fails, the exception is logged ([lines 425-428]), but execution continues to match action.type ([line 429]). Because action was never assigned on parse failure, this triggers UnboundLocalError, which crashes the main action-processing coroutine.

A single malformed client packet can therefore kill central game action handling for all agents.

Reproduction

  1. Connect to the coordinator TCP port.
  2. Send malformed payload (e.g., not-a-json-message).
  3. Action.from_json throws.
  4. Server then evaluates action.type and crashes run_game().

Impact

  • Service-wide denial of service.
  • No authentication required.
  • One packet is enough to break central gameplay processing.

Expected behavior

Malformed input should be handled safely:

  • Return a BAD_REQUEST style response to that client.
  • Continue processing future messages.
  • Never dereference action unless parsing succeeded.

Screenshots

Not applicable.

Environment

  • OS: macOS
  • Browser: N/A (TCP service)
  • Browser Version: N/A

Suggested fix

  • In the except block, enqueue an error response and continue the loop.
  • Guard dispatch (match action.type) behind successful parse.
  • Add regression test: malformed packet must not terminate run_game().

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions