Summary
A Reflected Cross-Site Scripting (XSS) vulnerability was discovered in the AI Playgrounds OAuth callback handler. The error_description query parameter was directly interpolated into an HTML script tag without proper escaping, allowing attackers to execute arbitrary JavaScript in the context of the victims session.
Root cause
The OAuth callback handler in site/ai-playground/src/server.ts directly interpolated the authError value, sourced from the error_description query parameter, into an inline <script> tag.
Impact
An attacker could craft a malicious link that, when clicked by a victim, would:
Steal user chat message history - Access all LLM interactions stored in the users session.
Access connected MCP Servers - Interact with any MCP servers connected to the victims session (public or authenticated/private), potentially allowing the attacker to perform actions on the victims behalf
Mitigation:
PR: https://github.com/cloudflare/agents/pull/841 https://github.com/cloudflare/agents/pull/841
Agents-sdk users should upgrade to agents@0.3.10
Developers using configureOAuthCallback with custom error handling in their own applications should ensure all user-controlled input is escaped before interpolation.