`use-mcp`'s oauth2 process uses a window.open call with untrusted mcp server provided data allowing for code execution under the page using it
The `authorizeEndpoint` parameter in `use-mcp` was not sanitised, allowing an attacker to inject script that ran in the context of the page using the library. A skilled attacker could escalate this cross-site scripting into code execution on the client.
Originally disclosed on HackerOne
- Triaged in 6 days
- Fixed in 2 months
- Paid in 6 days
- Disclosed after 3 months
Summary by the program
The authorizeEndpoint parameter from use-mcp version was susceptible to XSS. Sanitization of that parameter has been added in version 0.0.10 of use-mcp. A skilled attacker was able to turn this XSS into code execution on the client (https://verialabs.com/blog/from-mcp-to-shell/#xss---rce-abusing-mcps-stdio-transport).
The researcher was rewarded 550$ for this finding.
What the report shows
The target is use-mcp, one of Cloudflare's open source tools, and the feature involved is its OAuth2 authorisation flow. The program's summary states that the authorizeEndpoint parameter was susceptible to cross-site scripting (XSS).
The researcher, null_smashmaster0045, reported the issue through the Cloudflare Public Bug Bounty program on HackerOne, under the asset "Open source tools from Cloudflare". The weakness was classified as Cross-site Scripting (XSS) - Generic, with medium severity. The report was disclosed on 30 September 2025 and the researcher was rewarded 550 USD.
The program's summary also notes that a skilled attacker could turn this XSS into code execution on the client, and links to an external write-up describing that escalation path. The report itself does not include the request, the payload or the exact call site, so there is no code to reproduce here.
The fix was sanitisation of the authorizeEndpoint parameter, added in version 0.0.10 of use-mcp. The summary does not describe what the sanitisation checks or how it rejects a malicious value.
Root cause
The report frames the issue as missing sanitisation of the authorizeEndpoint parameter. The report frames this as missing sanitisation rather than a specific parsing mistake.
Impact
The report's own framing is an XSS that a skilled attacker can escalate to code execution on the client. The report's framing is an XSS that a skilled attacker can escalate to code execution on the client. The program rated the issue medium severity and paid 550 USD, The report does not enumerate specific data or actions an attacker could reach.
How this kind of bug works
Client-side libraries that speak to remote servers routinely receive configuration from those servers: authorisation endpoints, token endpoints, resource metadata, redirect targets. When such a value is handed to a browser API that navigates or opens a window, the trust boundary is crossed. window.open will happily accept schemes other than https, and a javascript: URL executes in the opener's context in many configurations. Even with an https URL, an attacker-controlled page can reflect parameters or serve content that the opener then interacts with.
The same class of problem appears wherever server-provided metadata is treated as trusted: OAuth discovery documents, dynamic client registration responses, and MCP server manifests are all attacker-influenced inputs from the client's point of view. The defence is to treat every such value as untrusted: parse it as a URL, allow only expected schemes (typically https), restrict hosts where the specification permits, and never pass raw strings to navigation APIs. Where a popup is needed, opening a blank window and then setting its location to a validated URL avoids handing an unparsed string to the browser.
How to test for it
- Identify features where the client fetches configuration from a server you control and then acts on it in the browser: OAuth discovery, authorisation endpoint selection, redirect handling, popup-based login flows.
- Stand up a test server that returns metadata with hostile values in the relevant field. Try a
javascript:URL, adata:URL, and anhttpsURL on a host you control that reflects query parameters. - Drive the client through the flow and watch what the browser does. A positive result is script executing in the application's origin, or a popup navigating to your host with attacker-controlled content rendered in a context the opener trusts.
- Confirm the origin of execution: check
document.domainor a unique marker in the console rather than assuming from the popup title. - Common false positives: the value is validated before use but the error is silent; the popup opens your URL but the opener never reads from it, so there is no cross-origin impact; the scheme is blocked by the browser's own popup handling rather than by the library.
How it is fixed
The standard fix is input validation at the point of use. Parse the endpoint as a URL, reject anything that is not https, and reject values that fail parsing. Where the protocol defines allowed hosts, enforce them. Open the window first and assign a validated URL to its location, rather than passing the raw string to window.open. Add regression tests that feed hostile schemes and malformed URLs through the flow. Version 0.0.10 of use-mcp added sanitisation of the authorizeEndpoint parameter.
Hunting notes
This bug class hides in integration code: SDKs, client libraries and connectors that consume remote metadata. Recon signals include libraries that implement OAuth discovery or dynamic registration, code that calls window.open, location.assign or location.href with a variable, and any flow where a server you can host supplies a URL. Read the source for the parameter names that reach navigation APIs, then trace whether validation exists. A clear reproduction with the origin of execution and the data reachable from it is what turns a theoretical finding into an accepted one.
What happened, in plain words
This report is about a small piece of software called use-mcp, one of Cloudflare's open source tools. Open source means the code is published for anyone to read and use. use-mcp is a library, meaning other developers add it to their own applications to get a feature without writing it themselves.
The feature in question is the OAuth2 authorisation flow. OAuth2 is a common way for an application to ask a user to log in through another service, without the application ever seeing the password. Think of it like a cloakroom ticket: you hand over your coat, get a ticket, and later the ticket proves you may collect the coat. The application sends the user to a login page, the user approves, and the application receives a token, a short piece of text that stands in for permission.
The library uses a value called authorizeEndpoint for the login step. An MCP server is a remote service that supplies tools and data to the application. The endpoint is simply a web address: the place the browser should open for the login step.
The program's summary says the authorizeEndpoint parameter was susceptible to cross-site scripting (XSS). XSS is a class of bug where an attacker gets their own code, usually JavaScript, to run inside a page that belongs to someone else. The browser cannot tell the difference between the site's own code and the injected code, so the injected code inherits the site's permissions.
The program's summary states that a skilled attacker was able to turn this XSS into code execution on the client. Code execution means the attacker's code actually runs on the client rather than merely being displayed as text. The summary links to an external write-up describing that escalation.
The researcher, null_smashmaster0045, reported the issue through the Cloudflare Public Bug Bounty program on HackerOne. A bug bounty program is a scheme where companies pay people who report security flaws responsibly instead of exploiting them. The asset was listed as "Open source tools from Cloudflare", the weakness as Cross-site Scripting (XSS) - Generic, and the severity as medium. The report was disclosed on 30 September 2025 and the researcher was rewarded 550 USD.
The fix was sanitisation of the authorizeEndpoint parameter, added in version 0.0.10 of use-mcp. Sanitisation means cleaning or checking a value before using it, the way a bouncer checks a ticket at the door. The summary does not say what the check looks for or how it rejects a bad value.
The report does not include the request, the payload or the exact line of code involved, so there is nothing to reproduce here.
In general, how this kind of bug works
In general, programs that talk to remote servers often receive their settings from those servers: where to log in, where to send tokens, where to redirect. From the client's point of view, all of that is attacker-influenced input. The mistake is treating it as trusted.
window.open accepts more than ordinary web addresses. A javascript: address runs code instead of loading a page, and in many setups that code runs in the context of the page that opened the window. Even a normal https address can be dangerous if the attacker controls that site and it echoes back input the opener then uses.
The same pattern appears in OAuth discovery documents, dynamic client registration responses and MCP server manifests. The defence is always the same: parse the value as a URL, allow only the schemes you expect, usually https, restrict hosts where the specification allows it, and never hand a raw string to a navigation function. Where a popup is needed, open a blank window first and then set its location to a validated address.
How to test for it
- Find features where the client fetches configuration from a server you control and then acts on it in the browser: OAuth discovery, authorisation endpoint selection, redirect handling, popup-based login flows.
- Run a test server that returns metadata with hostile values in the relevant field. Try a
javascript:URL, adata:URL, and anhttpsURL on a host you control that reflects query parameters. - Drive the client through the flow and watch the browser. A positive result is script running in the application's origin, or a popup navigating to your host with content rendered in a context the opener trusts.
- Confirm where the code actually ran: check
document.domainor a unique marker in the console rather than trusting the popup title. - Watch for false positives: the value may be validated silently, the opener may never read from the popup, or the browser itself may block the scheme rather than the library.
How it is fixed
The standard fix is validation at the point of use: parse the endpoint as a URL, reject anything that is not https, reject values that fail parsing, and enforce allowed hosts where the protocol defines them. Open the window first and assign a validated URL to its location. Add regression tests that feed hostile schemes and malformed URLs through the flow. Version 0.0.10 of use-mcp added sanitisation of authorizeEndpoint.
Hunting notes
This bug class hides in integration code: SDKs, client libraries and connectors that consume remote metadata. Useful signals are libraries that implement OAuth discovery or dynamic registration, code that calls window.open, location.assign or location.href with a variable, and any flow where a server you can host supplies a URL. Read the source for parameter names that reach navigation functions, then trace whether validation exists.
Glossary
- Open source: software whose code is published for anyone to read, use and modify.
- Library: reusable code that developers add to their own applications.
- MCP server: a remote service that supplies tools and data to an application.
- OAuth2: a protocol that lets an application obtain permission through another service without seeing the user's password.
- Token: a short piece of text that stands in for permission or identity.
- Endpoint: a web address that a program is meant to contact.
authorizeEndpoint: the setting that tells the library where to send the user for the login step.window.open: a browser function that opens a new window or tab at a given address.- XSS (cross-site scripting): a bug where an attacker's code runs inside another site's page and inherits its permissions.
- Code execution: the attacker's code actually runs, rather than being shown as harmless text.
- Sanitisation: checking or cleaning a value before it is used.
- Payload: the crafted input an attacker sends to trigger a bug.
- Bug bounty program: a scheme that pays people for reporting security flaws responsibly.
- Severity: a rating of how serious a flaw is.
- Origin: the combination of scheme, host and port that the browser uses to decide which page may access what.
- Scheme: the first part of a URL, such as
httpsorjavascript, which says how to handle it. javascript:URL: an address that runs code instead of loading a page.data:URL: an address that carries its content inline rather than pointing to a server.- Popup: a separate browser window opened by a page.
- False positive: a test result that looks like a bug but is not one.
- Regression test: an automated test that checks a fixed bug stays fixed.