The vulnerability exists in the preflightDiscordMessage function located in extensions/discord/src/monitor/message-handler.preflight.ts. The flaw was an incorrect order of operations where the application would perform resource-intensive audio transcription on incoming messages before verifying if the sender was authorized to interact in the channel. The transcription is handled by the resolveDiscordPreflightAudioMentionContext function.
An attacker could exploit this by sending messages with audio attachments to a guild channel where they are not on the allowlist. The server would then unnecessarily transcribe the audio, consuming CPU and memory resources, even though the message would be subsequently dropped due to the failed authorization check. This constitutes a resource exhaustion vulnerability (CWE-770).
The patch in commit ee52f64226a03efadfdf1e3b759e13424a3d4e41 corrects this by moving the member authorization check (resolveDiscordMemberAccessState) to execute before the call to the audio transcription function (resolveDiscordPreflightAudioMentionContext). This ensures that only messages from authorized users will trigger the expensive transcription process.