Intel

AIKIDO-2026-10997

@ai-sdk/mcp is vulnerable to Cross-Site Request Forgery (CSRF)

Cross-Site Request Forgery (CSRF) Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 4 days ago

60

Medium Risk

This Affects:

JS@ai-sdk/mcp
1.0.0 - 1.0.27
Fixed in 1.0.28
Are you affected? Scan for Free

TL;DR

The OAuth client in @ai-sdk/mcp generates a state parameter and forwards it to the authorization server, but never validates the value returned to the callback before exchanging the authorization code for tokens. An attacker can initiate their own OAuth flow against the MCP server, then trick a victim into visiting a crafted callback URL carrying the attacker's authorization code. The fix adds saveState and storedState hooks to the OAuthClientProvider interface, requires callers to forward the received state through callbackState, and rejects the token exchange with an OAuth state parameter mismatch error when the values do not match.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range.

Background info

@ai-sdk/mcp is vulnerable to Cross-Site Request Forgery (CSRF) in versions 1.0.0 - 1.0.27.

How to fix this

Upgrade the @ai-sdk/mcp package to the patch version.