Skip to content

[Crash] Unchecked msg.username.length access in validateRegister #50

@coderabbitai

Description

@coderabbitai

Summary

Server crashes when msg.username is undefined/null but code accesses msg.username.length.

Affected Code

server-services/start-services.js:517

case 'validateRegister':
  if (msg.username.length < 3 || !/^[A-Za-z0-9?!._-]+$/.test(msg.username)) {
    // CRASH if msg.username is undefined

Vulnerability

If a client sends {"cmd":"validateRegister"} without a username field, msg.username is undefined.

Impact

  • Remote server crash with single message
  • Denial of service

Proof of Concept

{"cmd":"validateRegister","password":"abc123"}

Recommended Fix

if (!msg.username || msg.username.length < 3 || !/^[A-Za-z0-9?!._-]+$/.test(msg.username)) {

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions