DEV Community

Ioneyrezende
Ioneyrezende

Posted on

Wildcard CORS turns an MCP server into a browser relay

Wildcard CORS turns an MCP server into a browser relay

A Model Context Protocol server is often placed on an internal address because its tools can reach repositories, local files, databases, or an automation service. That network position assumes the browser cannot freely read responses from the service. The Java SDK used by some MCP servers broke that assumption by adding Access-Control-Allow-Origin: * in its HTTP transports.

The issue is tracked as CVE-2026-34237 and described in advisory GHSA-hv2w-8mjj-jw22. The advisory lists affected io.modelcontextprotocol.sdk:mcp-core ranges below 1.0.0, below 1.1.1, and below 0.18.3, with fixes in 1.0.1, 1.1.1, and 0.18.3. Its CVSS v3 score is 6.1, with network attack, low complexity, no privileges, required user interaction, and changed scope.

The browser becomes the network position

An attacker-controlled page can ask a victim's browser to open https://internal-mcp-server/sse. The browser is already inside many network boundaries that block an external scanner. The wildcard response header lets the attacker's page read the server-sent event stream, including the session identifier returned when the connection opens.

With that identifier, the page can send POST requests to the same MCP endpoint. The victim's browser supplies the reachability and any ambient network trust that comes with it. The attacker does not need a route to the internal host. The page becomes a proxy inside the browser session.

The advisory compares this behavior with the Python SDK, which does not emit the wildcard header from either transport. That difference matters because the Java transport made a cross-origin policy decision on behalf of every server built with it. Applications that expected the same-origin policy to contain the endpoint were relying on a boundary the library removed.

Why a non-authenticated read still matters

CORS is not authentication. A server that requires a bearer token still needs a separate reason for allowing arbitrary websites to read the token-bearing response. Servers without application authentication are more directly exposed, but authenticated servers are not automatically safe. If the browser already holds a cookie, a client certificate, or a token that the page can cause the browser to send, the cross-origin read can become part of an authenticated request path.

The attack also depends on the user opening the hostile page while the internal service is reachable. That requirement lowers the score but does not remove the operational problem. Employees commonly browse while connected to the corporate network, and an endpoint that was never meant to be a browser API should not depend on user restraint.

Check the header, not just the SDK version

Upgrade MCP Java SDK packages to a patched release for the branch in use. Then inspect the deployed response headers at the actual ingress, servlet container, service mesh, and application endpoint. A reverse proxy may add or preserve a wildcard header even after the library is fixed. Test the SSE and streamable HTTP paths separately because the advisory identified different transport implementations.

If the service does not need browser clients, remove Access-Control-Allow-Origin entirely and keep access to the intended network path. If selected web applications need cross-origin access, allow only their exact origins, restrict allowed headers, and use credentials only when the design requires them. Do not use a wildcard plus a secret path as a substitute for authorization.

Review MCP servers that listen on loopback, Docker bridge addresses, developer workstations, or internal DNS names. Those locations are exactly where remote scanning is weak and browser-mediated access can be more useful to an attacker. Check access logs for direct SSE connections from unexpected origins and for POSTs that follow a newly created session.

The patched library removes one origin bypass. Teams still need to prove that the deployed endpoint has an explicit authentication policy, a deliberate CORS policy, and a network boundary that matches the data the server can reach.

References

Top comments (0)