@ai-sdk/mcp is vulnerable to Cross-Site Request Forgery (CSRF)
60
Medium Risk
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.
You are affected if you are using a version that falls within the vulnerable range.
@ai-sdk/mcp is vulnerable to Cross-Site Request Forgery (CSRF) in versions 1.0.0 - 1.0.27.
Upgrade the @ai-sdk/mcp package to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

SOC 2Compliant
ISO 27001Compliant