The MCP Server Can Be a Code Execution Boundary

The MCP Server Can Be a Code Execution Boundary

A remote MCP server did not need to poison a package, exploit a model, or win a prompt injection contest to reach a developer’s machine. During OpenCode’s OAuth sign-in flow, a server-controlled URL reached a Windows PowerShell command line through the client’s browser-launching dependency.

OpenCode fixed the issue in version 1.18.33. The uncomfortable part is how quietly that fix arrived: the release notes describe a refactor, and there is no CVE or vendor security advisory to make ordinary dependency scanners raise an alert.

The lesson is bigger than one OpenCode release. A remote MCP server is not just a provider of tool descriptions. It is an untrusted network peer whose response fields can cross into the host operating system.

What changed

Pillar Security reported a remote code execution flaw affecting OpenCode versions 1.0.137 through 1.18.32 on Windows and Windows Subsystem for Linux. The affected path required a remote MCP server to participate in OAuth authentication, but it did not require the developer to install a malicious local package or approve a second action after starting sign-in.

The researchers say Anomaly fixed the issue in OpenCode 1.18.33, released on September 28, 2026. The release notes include MCP browser-launch error handling, but they do not describe the security issue.

That means the patch is real, while the security classification is easy to miss. A repository can be on a vulnerable version and still look clean to a scanner that relies on CVE or advisory metadata.

The path from MCP response to PowerShell

The vulnerable flow is short:

remote MCP server
  -> OAuth discovery document
  -> authorization_endpoint
  -> OpenCode OAuth client
  -> browser launcher
  -> Windows PowerShell

When a remote MCP server requests authorization, the client discovers an authorization_endpoint. According to Pillar’s technical report, that value was passed into OpenCode’s browser-opening path without being treated as hostile input.

The browser launcher used by affected releases handled Windows differently from macOS and Linux. Pillar’s analysis identifies open@10.1.2 as the relevant dependency. Its Windows implementation encoded a PowerShell command but did not escape the target URL correctly.

PowerShell expands subexpressions inside double-quoted strings. A URL that appears to use an ordinary https scheme can therefore carry a PowerShell expression that runs before the browser launch completes. The browser can fail afterwards and the command has already crossed the boundary.

This is why a scheme allowlist is not the whole fix. The report notes that the research payload used an https URL, so a filter that rejects javascript: or data: still accepts the input. The actual remediation also depends on the dependency update that changes how the target is quoted.

The threat model was too narrow

The common MCP security story focuses on two problems:

  • A malicious tool description or result manipulates the model through prompt injection.
  • A compromised package runs code when a developer installs a local MCP server.

Both matter. They are not the only boundary.

A remote MCP server can be configured legitimately and compromised later. It can be hijacked through an expired domain, a registry mistake, or a service takeover. Nothing about the word remote makes its response data trusted. The client still parses that data and decides what crosses into the local browser, shell, filesystem, or credential store.

This is the same architectural mistake that keeps recurring in agent systems: treating a convenient local handoff as an authorization boundary. The OAuth flow was designed to make sign-in automatic. That convenience turned a server-provided string into an input to a host command launcher.

What operators should do

First, inventory OpenCode installations directly. Do not wait for a CVE feed to find this one.

opencode --version

Upgrade Windows and WSL installations to OpenCode 1.18.33 or later. The official release is the version reference, while Pillar’s report documents the affected range and platform conditions.

Second, treat remote MCP servers like browsers and email inputs. Validate every response field at the client boundary, not only tool names and tool arguments. A server-controlled URL should not be allowed to become a shell command simply because its scheme is https.

Third, reduce the blast radius. Run coding agents with least-privilege accounts, isolate them from long-lived credentials, and keep approval gates around actions that mutate the host. These controls do not repair the bug, but they determine what a compromised client can reach when the next parser fails.

Finally, record the dependency chain. A security review that lists only OpenCode and MCP misses the browser launcher underneath it. The useful question is not just “what can this agent call?” It is also “which libraries turn an external response into a host action?”

The verifier is the boundary

The interesting part is not that a string contained a shell metacharacter. The interesting part is that the system had several chances to assign trust and did not.

The MCP server supplied the value. The OAuth client forwarded it. The browser launcher translated it into a platform command. Each layer treated the previous layer as safe, and the developer’s machine paid for that assumption.

Agent security is not only about persuading the model to refuse a bad instruction. It is about verifying every transition from untrusted protocol data to a privileged local action.

The MCP server is not outside the trust boundary. It is one of the inputs that defines it.

Sources

Keep reading