The core of the vulnerability lies in the dreaming command handler, located within the registerDreamingCommand function. This handler failed to check if the user possessed the necessary operator.admin privileges before modifying the persistent 'dreaming' configuration. This allowed any user with operator.write access to change a sensitive, admin-level setting. The vulnerability was compounded by how the system handled client permissions; if a client had no scopes, the permission list was passed as undefined rather than an empty array. The initial implementation of the fix in the command handler would not have correctly handled this undefined case. Therefore, a second change was required in the chatHandlers to normalize missing scopes to an empty array, ensuring the new permission check would be robust and not bypassed. An attacker would trigger this vulnerability by sending a /dreaming on or /dreaming off command through the gateway without having the required operator.admin scope.