Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentMCP servers and tools

OpenCode on Windows: a remote MCP server's sign-in link could run PowerShell commands as the developer

CriticalOpenCodePillar Security

Eilon Cohen of Pillar Security disclosed a command injection (CWE-78) in OpenCode, the coding agent maintained by Anomaly, in versions 1.0.137 through 1.18.32 on Windows and WSL; macOS and Linux are not affected. When OpenCode signs in to a remote MCP server, the server's OAuth discovery response supplies the authorization endpoint, and OpenCode passed it to open 10.1.2, which puts the URL unescaped into a PowerShell command. PowerShell expands $(...) inside double-quoted strings, so a plain https URL with no spaces runs embedded commands as the developer even though the browser launch then fails, and it passes a check that only allows http and https. A server taken over later, or a domain that changes hands, can serve the payload. Pillar reported it on August 29, 2026; Anomaly merged a fix on September 25 and released 1.18.33 on September 28, which moves to open 11.0.4 and adds scheme checks. The fix was presented as a refactor with no advisory, and Anomaly declined to request a CVE, saying malicious MCP servers are outside its threat model. The same weakness appeared in mcp-remote (CVE-2025-6514). Pillar reported no sign of exploitation.

Replay the attack step by step in the Learning Center

How it happened

  1. The developer adds a remote MCP server to OpenCode on Windows or WSL and signs in to it.
  2. The server answers with an OAuth discovery document whose authorization endpoint is an https URL carrying a PowerShell $(...) subexpression.
  3. OpenCode hands the URL to the open package, which builds a PowerShell command around it, and the embedded commands run as the developer.

Impact

Code execution on a developer's Windows or WSL machine from an MCP server they connected to; no exploitation reported.

The fix

Update OpenCode to 1.18.33 or later, and find old installs yourself, since without a CVE scanners will not flag them. Until then, remove remote MCP servers you have not vetted on Windows and WSL, and review the list with opencode mcp list.

Lessons

  • Every field an MCP server sends is untrusted input, sign-in URLs included, and a scheme check does not make a URL safe to pass to a shell.
  • A security fix shipped as a refactor with no CVE leaves users and scanners unaware they need it.

Sources