The vulnerability lies in the improper trust of the i-twilio-idempotency-token HTTP header for deduplication and replay prevention of Twilio webhooks. This header is not part of the signed data from Twilio, allowing an attacker to capture a valid, signed webhook request and replay it multiple times by simply modifying the value of this header. The application would then process these replayed requests as new, unique events.
The analysis of the patch 1aadf26f9acc399affabd859937a09468a9c5cb4 reveals that the core of the vulnerability is in two helper functions: createTwilioRequestDedupeKey in extensions/voice-call/src/providers/twilio.ts and createTwilioReplayKey in extensions/voice-call/src/webhook-security.ts. Both of these functions explicitly read the i-twilio-idempotency-token header and used its value to generate a key for replay and duplicate checking.
The fix involves removing this logic and instead creating a verifiedRequestKey based on cryptographically signed components of the request, such as the signature, URL, and request parameters. This new, verified key is now generated in verifyTwilioWebhook and passed through the system, including to TwilioProvider.parseWebhookEvent, ensuring that the deduplication is tied to the authenticated request material.
The identified vulnerable functions are the ones that either directly contained the flawed logic (createTwilioRequestDedupeKey, createTwilioReplayKey) or were part of the call chain that relied on this flawed logic (verifyTwilioWebhook, TwilioProvider.parseWebhookEvent, and the main webhook handler VoiceCallWebhookServer.handleWebhook).