Skip to content
XSS Disclosed report Intermediate

AI Playground XSS to steal user-chat messages and access to connected MCP Server

matured_kazama Follow

Originally disclosed on HackerOne

  • Triaged in 40 hours
  • Fixed in 3 months
  • Paid in 2 months
  • Disclosed after 3 months

Summary by the program

Reflected XSS was found in the AI Playground OAuth handler (CVE-2026-1721) due to unescaped interpolation of the error_description parameter into a <script> tag by the researcher. A targeted attacker could execute JavaScript to access session-based chat history or interact with connected MCP servers on the victim's behalf during the user's session following a user interaction to click a phishing link. This issue is patched now and users of the open-source Agents SDK should upgrade to v0.3.10

Disclosed responsibly by Nishant Kumawat via Cloudflare Bug Bounty program on Hackerone

Summary by the researcher

Full Writeup: https://kazama.in/ai-playground-xss-to-mcp-takeover

The original report as published on HackerOne, by matured_kazama. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What the report shows

The target is the AI Playground, part of Cloudflare's Workers AI offering, and specifically its OAuth handler. The program's summary states that a reflected cross-site scripting flaw was found there, tracked as CVE-2026-1721, caused by unescaped interpolation of the error_description parameter into a <script> tag. The researcher is credited as Nishant Kumawat, and the finding was disclosed through the Cloudflare Public Bug Bounty program on HackerOne. The platform records the weakness as reflected XSS, the severity as low, and the disclosure date as 26 February 2026. No bounty amount is given.

The report does not walk through the individual requests or payloads used. What it does describe is the shape of the attack: a targeted attacker could execute JavaScript in the context of the AI Playground, and from there reach two things. First, the session-based chat history of the victim. Second, any MCP servers connected to the victim's session, which the attacker could interact with on the victim's behalf. Both of these depend on the victim's active session, so the attack requires the victim to click a phishing link while logged in.

The program's summary is explicit about the precondition: the impact only materialises "following a user interaction to click a phishing link". That is the standard reflected XSS delivery model, where the payload lives in a URL the attacker sends to the victim rather than in stored content.

The fix is stated plainly: the issue is patched, and users of the open-source Agents SDK should upgrade to v0.3.10. The researcher's own summary links to a fuller write-up, but the report text itself stops at the summary level and gives no reproduction steps, no HTTP transcript and no screenshots.

Root cause

The mistake the report points to is an output-encoding failure in the OAuth handler. The error_description parameter is interpolated into a <script> tag without escaping.

The report frames this as unescaped interpolation of the parameter into a <script> tag. Because the parameter is reflected straight back in the response, the flaw is classified as reflected rather than stored.

Impact

Within the victim's authenticated session, the injected script runs with the origin's privileges. The report names two consequences: reading session-based chat history, and interacting with connected MCP servers as the victim.

The report hedges this appropriately: the attacker must be targeted, and the victim must click a phishing link. There is no claim of mass exploitation, no claim that the bug works without a session, and no claim about persistence. The severity recorded by the platform is low.

How this kind of bug works

Reflected XSS happens when an application takes input from the request and writes it into the response without encoding it for the destination context. The browser parses the response as HTML and JavaScript, so any markup or script the attacker placed in the parameter becomes part of the page and executes under the site's origin.

The context matters more than the character set. A value placed between HTML tags needs <, >, &, " and ' handled. A value placed inside a <script> block needs JavaScript-safe encoding, because </script> can terminate the block and quotes can break out of string literals. A value placed in an attribute, a URL or a CSS block each has its own rules. The classic failure is applying one generic escape everywhere, or none at all.

Defences are layered. Context-aware output encoding is the primary control. A restrictive Content Security Policy that disallows inline script reduces the damage when encoding fails. Frameworks that auto-escape by default help, but they are frequently bypassed by code that marks values as safe or concatenates strings into templates. HttpOnly cookies limit what script can steal directly, though they do not stop script from acting through the session.

How to test for it

  1. Map every place where a request parameter appears in a response. OAuth and authentication handlers are high-value because they reflect error text, redirect targets and state values back into pages.
  2. For each reflection, note the context: HTML body, attribute, script block, URL, JSON. The context determines the payload.
  3. Send a benign marker first, such as a unique alphanumeric string, and confirm it appears unmodified. This separates reflection from filtering.
  4. Then send context-breaking characters: angle brackets, quotes, and for script contexts the sequence that closes a script block. Watch whether they come back encoded, stripped or intact.
  5. A positive result is a response where your input changes the structure of the page, for example a new element or a terminated script block, and where a browser executing the response runs your code. Confirm in a real browser, not just by reading the HTML.
  6. Test the parameter in the exact position the application uses it, including after redirects and in error paths, since handlers often encode on the happy path and forget on the error path.

Common false positives: the value is reflected but fully encoded, so it renders as text; the reflection lands in a context where the browser does not execute it, such as inside a comment or a non-executable attribute; a CSP blocks inline execution, so the payload is present but inert; or the input is reflected only in a response the victim never sees, such as an API JSON body with a strict content type. Each of these needs checking before reporting.

How it is fixed

Apply context-aware output encoding to every reflected value, with the encoding chosen for where the value lands. For values inside script blocks, avoid interpolating request data into executable JavaScript entirely; pass it as JSON with proper escaping, or keep it in a data attribute and read it from there. Add a Content Security Policy that disallows inline script and restricts script sources. Set cookies HttpOnly and SameSite where the application allows. Validate and allowlist parameters such as error_description where the format is known. The report says the issue is patched, with Agents SDK users advised to upgrade to v0.3.10.

Hunting notes

OAuth and SSO handlers are a strong hunting ground because they reflect many parameters, including error text, into pages that are often hand-built rather than framework-rendered. Look at callback endpoints, error pages, consent screens and any handler that echoes a provider's response. Parameters named for errors, descriptions, state, redirect and messages are worth trying first.

Recon signals: endpoints that return HTML with inline script blocks, pages that echo query parameters into JavaScript variables, and applications that mix server-rendered templates with client-side bootstrapping. A response that contains your marker inside a <script> block is the signal to dig further.

To make a report land, show the full path from a crafted link to executed code in a browser, and demonstrate a concrete consequence within the session, such as reading data the victim can see or performing an action the victim is authorised for. State the interaction requirement honestly, since reflected XSS always needs the victim to follow the link. Include the exact request and response, and note any CSP or cookie settings that affect exploitability.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

Cloudflare runs a service called Workers AI, and part of it is an "AI Playground". A security researcher, Nishant Kumawat, found a bug in the part of that page that handles OAuth. OAuth is the mechanism that lets a website ask another service for permission on your behalf, for example "let this app read my files". The bug is tracked as CVE-2026-1721, which is simply a public identifier for a known vulnerability.

The bug is a reflected cross-site scripting (XSS) flaw. In plain terms: the page took a value from the web address (the URL) and pasted it into the page without cleaning it first. If that value contains code, the browser runs it as if Cloudflare had written it. The value in question is a parameter called error_description.

The program's summary says the cause is "unescaped interpolation of the error_description parameter into a <script> tag". Escaping means converting special characters so they are treated as plain text rather than as instructions. Interpolation means inserting a value into a template. Here the value was inserted into a script block, so the browser treated it as program code.

What could an attacker do with that? The report names two consequences, both inside the victim's logged-in session:

  1. Read the victim's session-based chat history, meaning the conversations stored for the current login.
  2. Interact with any MCP servers connected to the victim's session, acting as the victim.

MCP (Model Context Protocol) is a standard that lets an AI assistant use external tools and data sources.

The attack is targeted and needs the victim to click a phishing link while logged in. That is how reflected XSS normally works: the malicious value travels in a link the attacker sends, and it only does anything when someone opens that link. The platform records the severity as low, and no bounty amount is given.

The issue is patched. Users of the open-source Agents SDK are advised to upgrade to v0.3.10.

In general, how this kind of bug works

A web page is built by a server and then read by your browser. When you open a link like https://example.com/page?name=hello, the server receives name=hello and may put hello into the page it sends back. That is called reflection: your input comes back in the response.

The danger is that the browser cannot tell which parts of the page the server wrote on purpose and which parts came from a stranger. If the server pastes hello in without cleaning it, and a stranger sends a link where the value is not hello but a piece of code, the browser runs that code. Because the code arrived inside a page from the real site, it runs with that site's permissions: it can read what the page can read and do what the page can do. That is cross-site scripting.

The place where the value lands matters more than the characters themselves. A value placed between HTML tags needs characters like <, >, &, " and ' handled. A value placed inside a <script> block needs JavaScript-safe encoding, because the sequence </script> can end the block early and quotes can break out of a string. A value in an attribute, a URL or a style block each has its own rules. The classic mistake is applying one generic escape everywhere, or none at all.

Defences come in layers. The main one is context-aware output encoding: encode each value for the exact place it lands. A Content Security Policy (CSP) is a set of rules the site sends to the browser saying which scripts may run; one that forbids inline script limits the damage when encoding fails. Cookies marked HttpOnly cannot be read by JavaScript, which limits what a script can steal directly, though it can still act through the session. Frameworks that escape by default help, but they are often bypassed when code marks values as safe or glues strings into templates.

How to test for it

  1. Find every place where a value from the request appears in the response. Login and OAuth handlers are high-value targets because they echo error text, redirect targets and state values back into pages.
  2. For each one, note the context: HTML body, attribute, script block, URL, JSON. The context decides what to send.
  3. Send a harmless marker first, such as a unique string of letters and digits, and check it comes back unchanged. This tells you the value is reflected rather than filtered out.
  4. Then send characters that could break the context: angle brackets, quotes, and for script contexts the sequence that closes a script block. Watch whether they come back encoded, removed or intact.
  5. A positive result is a response where your input changes the structure of the page, for example a new element or a script block that ends early, and where a real browser runs your code. Confirm in a browser, not just by reading the HTML.
  6. Test the parameter in the exact position the application uses it, including after redirects and on error paths. Handlers often encode on the normal path and forget on the error path.

Common false positives: the value is reflected but fully encoded, so it shows as text; it lands somewhere the browser does not execute, such as inside a comment; a CSP blocks inline execution, so the payload is present but inert; or it is reflected only in a response the victim never sees, such as a JSON API body. Check each of these before reporting.

How it is fixed

Apply context-aware output encoding to every reflected value. For values inside script blocks, do not put request data into executable JavaScript at all: pass it as JSON with proper escaping, or keep it in a data attribute and read it from there. Add a CSP that disallows inline script and restricts script sources. Set cookies HttpOnly and SameSite where possible. Validate and allowlist parameters such as error_description where the expected format is known. In this case the issue is patched, with Agents SDK users advised to upgrade to v0.3.10.

Hunting notes

OAuth and single sign-on handlers are good hunting ground because they reflect many parameters, including error text, into pages that are often hand-built rather than generated by a framework. Look at callback endpoints, error pages, consent screens and any handler that echoes a provider's response. Parameters named for errors, descriptions, state, redirect and messages are worth trying first.

Useful signals: endpoints that return HTML with inline script blocks, pages that echo URL parameters into JavaScript variables, and applications that mix server-rendered templates with client-side setup. A response containing your marker inside a <script> block is the signal to dig further.

To make a report land, show the full path from a crafted link to executed code in a browser, and demonstrate a concrete consequence within the session, such as reading data the victim can see or performing an action the victim is allowed to perform. State the interaction requirement honestly, since reflected XSS always needs the victim to follow the link. Include the exact request and response, and note any CSP or cookie settings that affect exploitability.

Glossary

  • XSS (cross-site scripting): a bug where a site puts attacker-supplied content into a page in a way that makes the browser run it as code.
  • Reflected XSS: XSS where the malicious value travels in the request (usually a link) and is echoed straight back in the response.
  • OAuth: a standard that lets a website obtain limited permission to act on another service on your behalf, without sharing your password.
  • OAuth handler: the part of an application that processes the OAuth flow, including callbacks and error messages.
  • Parameter: a named value in a URL, such as error_description in ?error_description=....
  • error_description: the parameter that carries a readable error message back from an OAuth provider.
  • Escaping / encoding: converting special characters so they are treated as plain text instead of instructions.
  • Interpolation: inserting a value into a template, such as a page or a script block.
  • <script> tag: the HTML element that marks a block of JavaScript for the browser to run.
  • CVE: a public identifier for a known vulnerability, here CVE-2026-1721.
  • Session: the state that keeps you logged in across requests, usually tied to a cookie.
  • Cookie: a small piece of data the browser stores for a site and sends back with each request.
  • HttpOnly: a cookie flag that stops JavaScript from reading that cookie.
  • SameSite: a cookie setting that limits when the cookie is sent on requests coming from other sites.
  • CSP (Content Security Policy): rules a site sends to the browser saying which scripts and sources are allowed.
  • MCP (Model Context Protocol): a standard that lets an AI assistant use external tools and data sources through an MCP server.
  • MCP server: a service that exposes tools or data to an AI assistant over MCP.
  • Agents SDK: the open-source SDK the report advises upgrading to v0.3.10.
  • Phishing link: a link sent by an attacker, disguised or presented so the victim clicks it.
  • False positive: a test result that looks like a bug but is not exploitable.
  • Allowlist: an explicit list of accepted values or formats, with everything else rejected.

More by matured_kazama

View all

6 more disclosed reports, best first.

More from Cloudflare Public Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.