Join our Newsletter — 33% off our NHI Course
Home› Guides› MCP Authorisation URL Injection: How Malicious Links Reach…
Guide Agent Identity & Access

MCP Authorisation URL Injection: How Malicious Links Reach Clients and How to Block Them

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

When an MCP client connects to a protected server, the server tells the client which URLs to fetch and which authorisation page to open in a browser, so a malicious or hijacked server can hand the client a URL designed to run code, execute script or phish the user. This guide explains where those server-controlled URLs enter the MCP authorisation flow, how unsafe handling turns them into command execution, cross-site scripting or credential phishing, and the client, host and registry controls that block them. It is written for MCP client and host developers, AI platform security teams and anyone approving remote MCP servers for use. It is based on the MCP specification revision 2026-07-28 and its Security Best Practices page, checked in November 2026; the specification changes often, so confirm against the current revision. The OAuth flow itself is covered in the MCP Authorisation Specification Guide and the credential choice in API Keys vs OAuth for MCP Servers; this page is about the URLs.

Key takeaways

  • Every discovery URL is attacker-controllable. The resource_metadata URL, the authorization_servers list and the endpoints in authorisation server metadata all come from, or are pointed to by, the MCP server the client is connecting to.
  • The browser launch is the dangerous sink. The specification's Security Best Practices say clients MUST allow only https:// (and http:// for loopback during development) and MUST NOT open URLs through cmd.exe, sh or PowerShell.
  • CVE-2025-6514 is the reference case. mcp-remote versions 0.0.5 to 0.1.15 passed a server-supplied authorization_endpoint to an OS launcher, leading to OS command injection (CWE-78, CVSS 9.6); 0.1.16 fixed it.
  • Validation is layered. Scheme allowlisting, strict URL parsing, issuer and resource identity checks, SSRF filtering and non-shell opening each stop a different variant; no single check is enough.
  • Show the user where they are going. Display the authorisation server host before opening the browser, and treat a server whose authorisation host is unexpected as untrusted until approved.

How MCP authorisation discovery works

Under the 2026-07-28 revision, authorisation is optional and applies to HTTP-based transports; stdio servers take credentials from the environment instead. When authorisation is in use, the client discovers everything it needs from the server it is trying to reach:

  1. 401 challenge: the client sends an unauthenticated request and receives 401 Unauthorized with a WWW-Authenticate: Bearer header that should carry a resource_metadata URL (RFC 9728 Section 5.1) and may carry a scope.
  2. Protected resource metadata: the client fetches that URL, or falls back to /.well-known/oauth-protected-resource at the endpoint path and then at the root. The document MUST list at least one entry in authorization_servers. RFC 9728 Section 3.3 requires the returned resource value to be identical to the resource identifier the client used, or the data MUST NOT be used.
  3. Authorisation server metadata: the client builds well-known URLs from the chosen issuer and tries, in order, /.well-known/oauth-authorization-server (RFC 8414) and /.well-known/openid-configuration (OpenID Connect Discovery), with path insertion for issuers that have paths. The issuer in the document MUST be identical to the issuer used to build the URL; otherwise the client MUST NOT use the metadata.
  4. Registration: the client obtains a client ID through a Client ID Metadata Document, pre-registration or Dynamic Client Registration (deprecated in this revision).
  5. Browser launch: the client builds an authorisation URL from authorization_endpoint, adds PKCE (S256), the resource parameter and scopes, records the expected issuer, and opens the URL in the user's browser.
  6. Callback and token: the client validates iss on the response (RFC 9207), then sends the code and verifier to token_endpoint.

Steps 1 to 5 all involve URLs that the client did not choose. Steps 1 to 3 are network fetches by the client; step 5 hands a URL to the operating system or a browser API.

How URL injection occurs

URL injection happens when a client treats a value from discovery as a safe web address and passes it on without checking what it really is. The table lists each server-influenced value and what goes wrong without validation.

ValueSourceClient actionFailure without validation
resource_metadataMCP server WWW-Authenticate headerHTTP fetchSSRF to internal services or cloud metadata endpoints
authorization_serversProtected resource metadataBuilds well-known URLs, HTTP fetchSSRF; selection of an attacker's authorisation server
issuerAuthorisation server metadataRecorded and later comparedMix-up if the document is accepted from a different host
authorization_endpointAuthorisation server metadataOpened in browserNon-web scheme executed, shell metacharacters interpreted, or phishing page shown
token_endpoint, registration_endpointAuthorisation server metadataHTTP POSTSSRF with state-changing requests; code or secret sent to the wrong host
error_uri, error_descriptionAuthorisation responseDisplayed or linkedPhishing text or links; the spec forbids acting on them when iss does not match

The Security Best Practices page names two client-side injection paths for the authorisation URL itself:

  • Script URL injection: a server supplies a javascript: URL as the authorisation endpoint and the client passes it to window.open() or a similar API, giving script execution inside the client application.
  • Command injection via shell execution: a server supplies a URL containing shell metacharacters and the client opens it through cmd.exe, PowerShell or a shell script, which interprets part of the string as further commands.

Delivery does not need a compromised well-known server. The best practices page and the JFrog analysis of CVE-2025-6514 both describe the precondition as connecting to an untrusted or malicious MCP server; JFrog adds plain HTTP connections on a local network, where an attacker can tamper with responses. A user persuaded to add a server from a link, a shared configuration file or an unvetted directory listing is enough. This is the same pattern as ATT&CK T1204.001 Malicious Link combined with T1203 Exploitation for Client Execution.

Impact: phishing and command execution

OutcomeMechanismTypical result
OS command executionAuthorisation URL passed to a shell-based launcherCode runs with the user's privileges on the developer workstation
Client-side script executionjavascript: or data: URL opened inside a web or Electron-style clientSession theft; in proxy architectures, theft of the local proxy token and spawning of stdio commands
Credential phishingValid https:// URL to a look-alike sign-in pageUser enters corporate credentials or approves consent for an attacker client
Internal network accessDiscovery URLs pointing at private or link-local addressesCloud instance credentials or internal service data reflected to the attacker

CVE-2025-6514 illustrates the first row. According to the GitHub advisory GHSA-6xpm-ggf7-wc3p, mcp-remote, a proxy that lets local clients reach remote MCP servers, was exposed to OS command injection when connecting to untrusted servers, through crafted input in the authorization_endpoint URL. JFrog's analysis explains that the value was passed to the open npm package; on Windows that package launches through PowerShell, allowing full command execution, while on macOS and Linux it uses open or xdg-open without a shell, which JFrog says limited impact to launching executables. Upgrading to 0.1.16 or later is the fix.

The impact is high because MCP clients run on developer and analyst machines that often hold cloud credentials, source code access and tokens for other MCP servers. See the Local MCP Server Security Guide for what sits within reach of a compromised client.

Client-side defences

The specification's Security Best Practices set the baseline. Implement every item, in this order.

  1. Allowlist schemes: accept only https:// for authorisation URLs, and http:// only for loopback (localhost, 127.0.0.1, ::1) behind an explicit development setting. Reject javascript:, data:, file:, vbscript: and anything else. Use an allowlist, not a blocklist.
  2. Parse, then rebuild: parse the endpoint with a standards-compliant URL parser, reject parse failures, credentials in the authority, and characters a shell could interpret, then build the final authorisation URL from the parsed components and your own encoded query parameters rather than concatenating strings.
  3. Open without a shell: never pass the URL through cmd.exe, sh or PowerShell. Use a platform URL-opening API or launch the handler with an argument array and no shell. In Electron and similar desktop frameworks, treat the open-external call as a sink: the Electron security checklist says not to use shell.openExternal with untrusted content, so validate before calling it.
  4. Enforce identity checks: reject protected resource metadata whose resource does not match, and authorisation server metadata whose issuer does not match the URL it came from. Verify TLS certificates (RFC 9728 Section 7.3). Record the issuer before redirecting and validate iss on return.
  5. Constrain discovery fetches: require HTTPS, block private, loopback and link-local ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8, 169.254.0.0/16, fc00::/7, fe80::/10), validate every redirect hop, and pin DNS between check and use. Use a maintained library rather than hand-written IP parsing. Server-side clients should route discovery through an egress proxy. See the SSRF Prevention Guide.
  6. Show a pre-launch confirmation: before opening the browser, show the user the MCP server name, the authorisation server host (not just a friendly name) and the scopes requested, and require a click. Flag when the authorisation host is on a different registrable domain from the MCP server, or has never been seen before.
  7. Harden web-based clients: apply a Content Security Policy with script-src 'self' and default-src 'self' so an injected script URL cannot run, and isolate any local proxy token from the renderer.
  8. Log and keep dependencies current: log rejected URLs with the server identity, and track OAuth and MCP proxy libraries such as mcp-remote in your software inventory so advisories reach you.

Choosing an opening approach

ApproachRiskWhen to use
Shell command with URL stringMetacharacters interpreted as commandsNever, per the specification
Handler launched with argument array, no shellNon-web schemes can still launch registered handlersAcceptable only after scheme allowlisting
Platform or framework URL-open APISame scheme-handler risk if unvalidatedPreferred for desktop clients, after validation
Embedded web viewScript injection into the client context; users cannot see the real address barAvoid for authorisation; use the system browser
Device or out-of-band flow showing the URL for the user to openPhishing still possible, no local executionHeadless and server-side clients

Server and registry defences

Client fixes stop exploitation; server, host and registry controls reduce exposure to untrusted servers in the first place.

  • Approved server lists: organisations deploying MCP clients should restrict which remote servers can be added, through managed configuration or an MCP gateway, and record the expected authorisation server host for each. See Agent Gateway vs MCP Gateway.
  • Registry vetting: directories and internal catalogues should fetch each listed server's protected resource and authorisation server metadata, reject listings whose endpoints use non-HTTPS schemes or unexpected hosts, and re-check on a schedule because metadata can change after approval.
  • Server operators: serve all metadata and authorisation endpoints over HTTPS, keep authorization_servers to the hosts you control or contract, and emit iss in authorisation responses (the specification signals this will move from SHOULD to MUST).
  • Authorisation servers: follow the specification's open redirection rules: validate exact pre-registered redirect URIs, clearly display the redirect URI hostname, warn on localhost-only redirect URIs, and apply SSRF protection when fetching Client ID Metadata Documents.
  • Configuration hygiene: one-click server installation must show the exact command or URL being added and require approval, as the best practices page requires for local server configuration.

Detection and response

Most of this activity happens on endpoints, so detection combines client telemetry with endpoint and network signals.

  • Client logs: alert on rejected authorisation URLs (bad scheme, parse failure, issuer or resource mismatch), and on a known server whose authorisation host changes.
  • Endpoint telemetry: watch for MCP client, Node.js or proxy processes spawning cmd.exe, powershell.exe, sh or unexpected executables, especially just after an OAuth prompt.
  • Network: flag client hosts requesting link-local metadata addresses or internal ranges during MCP connection set-up, and sign-in pages on newly registered domains reached from MCP prompts.
  • Software inventory: query for vulnerable mcp-remote versions (0.0.5 to 0.1.15) and other OAuth helper packages across developer machines and CI images.

If a client may have opened a malicious authorisation URL: isolate the workstation, capture the client configuration and logs (the server URL, the metadata responses if cached, process trees), remove the server from configuration, upgrade the client, and rotate tokens and credentials reachable from that machine, including tokens for other MCP servers. If the user entered credentials on a phishing page, reset them, revoke sessions and review consent grants. See the MCP Tool Poisoning Detection guide for related client-side detections.

Metrics

  • Client coverage: share of MCP clients in use that implement scheme allowlisting and non-shell opening (from vendor statements or testing).
  • Vulnerable package count: endpoints with known-vulnerable MCP proxy or OAuth helper versions; target zero.
  • Unapproved servers: remote MCP servers configured outside the approved list.
  • Rejected URL events per month, each reviewed.
  • Time to patch MCP client advisories across developer machines.

Framework mapping

FrameworkReferenceHow it applies
MITRE ATT&CKT1204.001 Malicious Link; T1203 Exploitation for Client Execution; T1059 Command and Scripting InterpreterMalicious server URL leading to client exploitation and command execution
CWECWE-78 OS Command InjectionThe weakness class assigned to CVE-2025-6514
NIST SP 800-53 Rev 5SI-10 Information Input Validation; SA-11 Developer Testing and Evaluation; CM-7 Least Functionality; SI-4 System MonitoringValidating server-supplied URLs, testing clients, restricting launch paths, monitoring process spawns
NIST CSF 2.0PR.PS-06; DE.CM-09Secure development of MCP clients; monitoring of endpoint software behaviour

Common failure patterns

  • Trusting metadata because it arrived over the protocol: clients treat authorization_endpoint as configuration rather than untrusted input.
  • Convenience launchers: using a cross-platform "open this URL" helper that shells out on one platform, so the bug appears only on Windows and escapes testing elsewhere.
  • Blocklisting schemes: rejecting javascript: but not file:, custom protocol handlers or case and encoding variants.
  • Skipping identity checks: not comparing the metadata issuer or resource with the URL used, which lets one host speak for another.
  • Silent browser launch: opening the authorisation page with no indication of the host, so users cannot spot a look-alike domain.
  • Forgotten transitive packages: an MCP proxy pulled in by a configuration snippet stays on a vulnerable version long after the advisory.

Practitioner checklist

  • Allowlist https:// (and loopback http:// in development only) for every authorisation URL.
  • Remove every shell-based URL opening path; use a non-shell API after validation.
  • Parse and rebuild authorisation URLs rather than concatenating server strings.
  • Enforce RFC 9728 resource matching, RFC 8414 issuer matching and RFC 9207 iss validation.
  • Apply SSRF controls to all discovery fetches and redirect hops.
  • Show the authorisation host and scopes and require confirmation before opening the browser.
  • Restrict remote MCP servers to an approved list with expected authorisation hosts.
  • Inventory and patch MCP proxy and OAuth helper packages, including mcp-remote 0.1.16 or later.
  • Alert on MCP client processes spawning shells and on rejected authorisation URLs.

Standards and references

Related NHI Mgmt Group resources: MCP Authorisation Specification Guide · MCP Security Best Practices Explained · Remote MCP Server Hardening Guide · MCP Client Support Tracker · API Keys vs OAuth for MCP Servers

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.