Security

opencode MCP Vulnerability: Malicious Server Runs PowerShell

CSA and Corgea notes show opencode, MCP Inspector and Copilot in Visual Studio letting untrusted data reach process launch paths. Fixed versions and next steps.

Trị Trương · 10 min read
opencode MCP Vulnerability: Malicious Server Runs PowerShell

AI coding assistants are now part of many development teams’ daily routine, but October 2026 exposed a repeating weakness: when such a tool connects to an outside MCP server, a single piece of data supplied by that server can become a command that runs on the developer’s machine. The opencode MCP vulnerability disclosed by Pillar Security on 19 October, and CVE-2026-103572 in GitHub Copilot for Visual Studio, are two clear examples.

This article draws on the Cloud Security Alliance research note (22 October 2026) and Corgea’s analysis (29 October 2026) to explain in plain language what happened, why it matters for companies with development teams, and what to do about it.

What MCP is and why the “launch path” is the weak point

The Model Context Protocol (MCP) is a protocol that lets AI assistants connect to outside tools and data sources such as file systems, databases or web services. Two connection styles are common: stdio servers, which run as a local program started from a configuration file, and remote servers that use OAuth to sign in through a browser.

The CSA note calls the point where data turns into an operating-system process the “launch path”. For stdio servers it is the configuration file; for remote OAuth servers it is the browser-launch helper. CSA observes that MCP clients often treat configuration and discovery metadata as inert settings when in practice they behave like command lines. Once an attacker controls that data, the result is remote code execution.

The opencode MCP vulnerability: a malicious server runs PowerShell

opencode is an open-source coding assistant that runs in the terminal. According to CSA, the researcher Eilon Cohen of Pillar Security found the flaw. The affected versions are opencode 1.0.137 through 1.18.32, on Windows and WSL only; macOS and Linux are not affected.

The mechanism works like this:

  1. A malicious remote MCP server returns an OAuth discovery document in which the authorization_endpoint field is chosen by the attacker.
  2. opencode passes that address to the “open” npm package (version 10.x) to launch the browser.
  3. On Windows and WSL the package builds a PowerShell command that wraps the address in double quotes without escaping it.
  4. PowerShell expands a $(…) subexpression inside the address, so the attacker’s command runs before the browser opens.
  5. The address is still a valid https URL, so it passes the scheme check, and nothing compares the endpoint with the origin of the configured server.

Pillar says no user action beyond configuring the server is needed; The Hacker News reports that the browser step only runs when a user starts sign-in, for example with opencode mcp auth. Pillar proposed a CVSS score of 9.8 (CWE-78), while CSA argues that a rating of about 8.8 fits better if the sign-in has to be started. Pillar reported no exploitation in the wild.

Five steps from a malicious MCP server to PowerShell command execution on Windows
How a malicious MCP server runs commands

Disclosure timeline and the developer’s response

The timeline shows a common problem: the flaw was initially considered outside the threat model.

  • 29 August 2026: Pillar reports privately through a GitHub Security Advisory.
  • 25 September 2026: Anomaly, which develops opencode, acknowledges the report and says a malicious MCP server is outside its threat model; the same day it merges PR #51414, consolidating the browser-launch call sites.
  • 28 September 2026: version 1.18.33 upgrades the “open” package to 11.0.4, which single-quotes the target, and adds an openUrl() helper plus a check that rejects non-HTTP(S) schemes.
  • 19 October 2026: Pillar discloses and proposes a severity of 9.8.
  • 29 October 2026: Corgea publishes its analysis and notes that the current release is 1.19.4.

One point deserves attention: the fix shipped without an opencode CVE or security advisory of its own, so ordinary vulnerability scanners may not flag vulnerable installs. The sources are not fully consistent on identifiers either: CSA says there is no CVE for opencode, while Corgea lists CVE-2026-119025 as tied to the “open” package. The safe approach is to track the opencode-ai version number itself. According to CSA, the disclosure came days after an unrelated breach of opencode’s hosted console that may have exposed stored provider API keys, although the note does not cover that incident in detail.

MCP Inspector had the same flaw

Corgea reports that MCP Inspector, the tool used to test MCP servers, also passed the server-supplied authorization_endpoint to open() through several helper functions. Fixes and six advisories were released on 21 October 2026.

  • @modelcontextprotocol/inspector 2.0.0 to 2.11.0 (GHSA-q978-78c7-phqw, CVSS 8.8): fixed in 2.12.0, which upgrades open to v11 and only opens normalised http(s) URLs.
  • Inspector 0.13.0 to 1.0.2 (GHSA-4fc4-wcmh-4g86, CVSS 9.6): a separate OAuth callback bug affecting all operating systems, fixed in 1.0.3. Previously, a crafted redirect could switch a remote connection to a local stdio process.
  • The open package before 11.0.0 is the underlying sink. Corgea records CVE-2026-119025 for it, with a CVSS 3.1 score of 7.5.

Users are also advised to stop running Inspector with DANGEROUSLY_OMIT_AUTH=true. It is a reminder that developer tools deserve the same care as production software whenever they touch credentials.

GitHub Copilot in Visual Studio: a trailing dot in a filename

The second example in the CSA note is CVE-2026-103572, found by researcher Johann Rehberger (Embrace The Red). It affects GitHub Copilot in Visual Studio 2026, earlier Visual Studio releases (including 2022) and SSMS. Microsoft’s affected-product list names only the two Visual Studio versions, so SSMS users should confirm their update with Microsoft.

The mechanism is subtle but easy to follow:

  • An edit-confirmation routine in Microsoft.VisualStudio.Copilot.Core.dll is supposed to require user approval before the AI agent changes sensitive files such as .mcp.json, but it compares filename strings.
  • Windows silently drops a trailing period, so writing to “.mcp.json.” passes the check yet actually lands on “.mcp.json”.
  • A “..\” path traversal from the Extensions directory could read SSMS.isolation.ini, exposing an installation ID that lets an attacker build the per-installation settings path and modify it.

Both attack chains start with indirect prompt injection, meaning malicious instructions in an opened file or MCP output. In the first, the agent adds an attacker-defined stdio server to .mcp.json, enables it, and the IDE then launches the command. In the second, available only in Visual Studio, the agent rewrites the ripgrep path in settings.VisualStudio.json so that Copilot search runs an attacker’s executable. The proof of concept launched calc.exe.

Rehberger said the model he tested was weak against indirect prompt injection. He reported the issue on 4 August 2026, Microsoft confirmed it on 16 September and fixed it in the 13 October 2026 Patch Tuesday, rating it Important with CVSS 8.8 and judging it out of scope for a bounty. The fixed builds, per Microsoft’s security guidance, are 17.14.42 for Visual Studio 2022 17.14 and 18.10.4 for Visual Studio 2026 18.10. Microsoft reported no exploitation at the time the note was written.

Milestones from the opencode report to the Copilot and MCP Inspector fixes
Disclosure and fix timeline

The common thread: checked in one form, executed in another

CSA draws a pattern from the two cases: untrusted data reached the code that launches a process because the launch path trusted it. Both had controls, but the check examined a different representation from the one that was executed. opencode checked the URL scheme, yet PowerShell interpreted the string. Copilot checked the filename, yet the file system normalised it.

Windows-specific behaviour, such as PowerShell subexpressions and Win32 path normalisation, appears in both. CSA also links the cases to its earlier work on MCP auto-execution and repository poisoning. The pattern resembles the risks we discussed when covering the exploited LiteLLM flaw in the AI tooling ecosystem.

In other words, the threat model of AI coding tools differs from traditional software. Data from a server, a file in a repository or a search result can all be an entry point, and agents that can write configuration files can be steered into widening their own permissions.

Who is affected and the real business risk

The risk from the opencode MCP vulnerability and similar flaws depends on which tools your developers use and which servers they connect to:

  • Developer workstations usually hold SSH keys, cloud access tokens, API keys and source code. A command running on such a machine can be the first step of a software supply-chain intrusion.
  • Teams on Windows or WSL with opencode are directly affected by the opencode flaw.
  • Teams using Visual Studio or SSMS with Copilot should check the October Patch Tuesday updates.
  • Outsourcing firms and freelancers often try many AI tools on personal machines that have access to clients’ systems.

Because the opencode flaw needs a malicious MCP server, the risk depends on whether you add MCP servers from unknown sources. That is why a policy on which MCP servers are allowed matters as much as the patch. If your company is bringing AI into its workflows, AI integration and automation services should come with a safety review of every connected tool.

Concrete response steps

To deal with the opencode MCP vulnerability and its relatives, work through the steps below in order.

  1. Inventory the AI coding tools in use: opencode, MCP Inspector, Copilot, other IDEs, and the list of configured MCP servers.
  2. Update opencode to 1.18.33 or later on every Windows and WSL machine. Because there is no CVE, check the opencode-ai package version directly rather than waiting for scanners, including npx caches and lock files.
  3. Update MCP Inspector to 2.12.0 or 1.0.3 depending on the branch in use.
  4. Apply the October 2026 Visual Studio updates, and confirm SSMS coverage with Microsoft.
  5. Remove MCP servers of unknown origin. If you cannot upgrade right away, remove unvetted remote MCP servers; the command opencode mcp list shows configured ones.
  6. Hunt for traces: look for unexpected entries in .mcp.json, changes to enabledMcpServers or the ripgrep path, and suspicious child processes such as powershell.exe -EncodedCommand under IDE or opencode parents. CSA stresses these are hunting heuristics, not published indicators of compromise.
  7. Rotate secrets if a vulnerable version ever connected to an untrusted server: check PowerShell logs (Event IDs 4104 and 4688) and change every credential stored on that machine.
Four fixed versions for opencode, MCP Inspector and Visual Studio
Fixed versions to remember

Building a safe policy for AI coding tools

Beyond patching, CSA offers short-term and strategic recommendations that small firms can adopt at their own scale:

  • Manage MCP configuration as a controlled artefact: approved server lists, pinned origins and monitoring of config changes.
  • Require human review of agent-authored changes to MCP, IDE and task configuration files.
  • Where possible, enforce controls outside the agent: operating-system integrity protection for launch configuration, sandboxing MCP subprocesses away from developer credentials, and egress limits on remote MCP origins.
  • When buying or choosing tools, ask vendors how they scope trust in MCP servers and whether they issue CVEs for flaws that need a malicious server.

For developers of MCP tools, CSA advises passing URLs as argument vectors instead of shell strings, binding OAuth discovery to the configured origin, and checking canonicalised paths, including Windows edge cases such as trailing dots, trailing spaces, \\?\ prefixes and 8.3 short names.

Quick checklist for development teams

  • An approved list of AI coding tools and MCP servers exists.
  • opencode-ai is 1.18.33 or later on every Windows and WSL machine.
  • MCP Inspector is on 2.12.0 or 1.0.3 or later.
  • Visual Studio has received the October 2026 update.
  • Nobody runs Inspector with DANGEROUSLY_OMIT_AUTH=true.
  • Changes to .mcp.json go through human review.
  • API keys and credentials on developer machines are least-privilege and short-lived.

If you need help assessing the security of an AI-assisted development workflow, you can contact Quy Nhon ADV to talk it through.

FAQ

Has the opencode MCP vulnerability been exploited in the wild?

Pillar Security reported no exploitation in the wild. Even so, the mechanism has been publicly described, so you should update soon.

I use macOS or Linux. Am I affected?

According to CSA, the opencode flaw affects only Windows and WSL because it relies on how PowerShell handles strings. MCP Inspector, however, had a separate OAuth callback bug that affected all operating systems in older versions.

Why does this flaw have no CVE?

According to CSA, opencode has no CVE or advisory of its own because the developer considered a malicious MCP server outside its threat model. Corgea records a CVE for the underlying open package, so track by version number instead of relying on a CVE.

Has Copilot been patched?

Microsoft fixed CVE-2026-103572 in the 13 October 2026 Patch Tuesday, with builds 17.14.42 for Visual Studio 2022 17.14 and 18.10.4 for Visual Studio 2026 18.10. SSMS users should confirm their update with Microsoft.

Should we stop using AI coding assistants?

There is no need, but use them under control: connect only approved MCP servers, update regularly, review changes made by agents and keep credentials separate from the environment where the tools run.

Sources: Cloud Security Alliance, Corgea

Taking on new projects

Let’s build
what’s next.

You have the idea. We have the technology to make it real.

Phone / WhatsApp
096.279.2345
You need

We only use this to get back to you.

Chat on WhatsApp Call +84 96 279 2345