Skip to content

fix(x): harden CRC challenge token validation - #775

Merged
dancer merged 3 commits into
mainfrom
mukundsarma/vuln-13280-crc-endpoint-hmac-oracle
Aug 3, 2026
Merged

fix(x): harden CRC challenge token validation#775
dancer merged 3 commits into
mainfrom
mukundsarma/vuln-13280-crc-endpoint-hmac-oracle

Conversation

@dnukumamras

@dnukumamras dnukumamras commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up hardening for the X webhook CRC challenge.

The CRC challenge endpoint returned an HMAC over any caller-supplied crc_token, using the same construction and secret as POST webhook signature verification. That let a caller have an arbitrary body signed via the public GET challenge and replay the response as x-twitter-webhooks-signature on a forged POST.

crc_token is now restricted to X's opaque token shape before signing. A webhook event body is JSON and can never match, so a CRC response can no longer double as a POST event signature. Both base64 and base64url alphabets are accepted so a legitimate token is never rejected. verifySignature is unchanged.

Regression tests: a webhook-shaped crc_token is rejected with 400 and no response_token; a signature the challenge can produce (for a valid token) verifies only against a body equal to that token, which is not event JSON, so no handler is dispatched. 216 adapter-x tests pass.

The CRC challenge endpoint returned an HMAC over any caller-supplied
`crc_token`, sharing the same construction and secret as POST webhook
signature verification. A caller could have an arbitrary webhook body
signed via the public GET challenge and replay the response as
`x-twitter-webhooks-signature` on a forged POST.

Reject any `crc_token` outside X's opaque token shape before signing.
A webhook event body is JSON and can never match, so a CRC response can
no longer double as a POST event signature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dnukumamras
dnukumamras requested a review from a team as a code owner August 3, 2026 06:13
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, v0 Aug 3, 2026 12:05pm
chat-sdk-nextjs-chat Ready Ready Preview Aug 3, 2026 12:05pm

Accept both base64 and base64url alphabets so a legitimate token is
never rejected, and trim the comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dnukumamras dnukumamras changed the title fix(x): restrict CRC challenge token shape to close signing oracle fix(x): harden CRC challenge token validation Aug 3, 2026
@dancer
dancer merged commit b674923 into main Aug 3, 2026
17 checks passed
@dancer
dancer deleted the mukundsarma/vuln-13280-crc-endpoint-hmac-oracle branch August 3, 2026 12:06
bensabic pushed a commit that referenced this pull request Aug 4, 2026
Follow-up and hardening for two inbound parsers.

- **Teams** — HTML-to-text conversion now strips tags until the output
is stable, so nested or malformed markup can't leave a partial tag
behind. A shared `stripHtmlTags` helper backs both the format converter
and the Graph message converter (was three inline single-pass regexes).
- **Slack** — the link-unfurl fallback bounds the length of bracketed
URLs parsed from message text, avoiding a quadratic scan on adversarial
input. Valid links are unaffected.

Two changesets (`@chat-adapter/teams`, `@chat-adapter/slack`); no
public-type change. Independent of #774/#775.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants