AI agent · October 4, 2026

OpenCode on Windows and WSL ran commands from a malicious MCP server during OAuth sign-in

Pillar Security disclosed that OpenCode 1.0.137 through 1.18.32 passed the OAuth authorization URL supplied by a remote MCP server to a browser launcher that, on Windows and WSL, built a PowerShell command without escaping it. A hostile or later-compromised MCP server could therefore run code on the developer's machine when they signed in with opencode mcp auth. The fix shipped in 1.18.33 on 28 September 2026 without an advisory or CVE, so scanners will not flag old installs; update and remove MCP servers you have not vetted.

DisclosedOctober 4, 2026
AffectedOpenCode, opencode-ai, Anomaly
TypeAI agent
StatusResolved

What was exposed

Code execution with the developer's privileges, and so every credential the user account can read: model provider API keys stored by OpenCode, MCP server tokens, Git and cloud credentials, SSH keys and .env files. Pillar explains the mechanism: during MCP OAuth, OpenCode reads the authorization_endpoint from the server's discovery document and passed it unchecked to the open package (version 10.1.2). On Windows, open builds a PowerShell -EncodedCommand, and PowerShell expands a $(...) subexpression inside the double-quoted target, so an otherwise valid https:// URL can carry a command. Scheme validation does not stop it. No prompt injection or extra user action beyond the normal sign-in is needed. macOS and Linux are not affected because their launchers do not pass the URL through a shell. Pillar's proof of concept writes a file; it reports no exploitation in the wild and proposes CVSS 9.8.

Am I affected?

You are affected if you ran OpenCode 1.0.137 through 1.18.32 on Windows or inside WSL, had a remote MCP server configured, and started its OAuth sign-in (for example opencode mcp auth). A server that was trustworthy when you added it still matters, since its domain or deployment could later change hands. Run opencode --version and opencode mcp list to see your version and configured servers. Because there is no CVE or advisory, dependency scanners will not report this; check installs directly.

What to do now

  1. Update OpenCode to 1.18.33 or later.
  2. If you cannot update on Windows or WSL, remove remote MCP servers you have not vetted from your configuration.
  3. If you signed in to an unfamiliar MCP server on an affected version, rotate the provider API keys and tokens stored on that machine.
  4. Inventory OpenCode installs across developer machines directly, since scanners rely on advisories that do not exist for this issue.

Keys to rotate

Guides to the credentials this incident put at risk:

Timeline

  1. Pillar Security reports the issue privately through a GitHub security advisory. Source
  2. The fix (PR #51414) is merged; Pillar says the vendor stated that malicious MCP servers fall outside its threat model. Source
  3. OpenCode 1.18.33 is published to npm. Source
  4. Pillar's timeline gives this as the publication date of the research; the article byline shows 19 October 2026. Source

Indicators

From the advisories listed below. Use them to search your logs, lockfiles and workflow runs.

  • An MCP OAuth discovery document whose authorization_endpoint contains $( or other PowerShell syntax.
  • OpenCode versions 1.0.137 through 1.18.32 on Windows or WSL.

What this changes for credential handling

  • Data from a remote MCP server reached a shell during sign-in. BotPassword treats MCP servers as untrusted and keeps the user's stored keys out of reach of a compromised agent process.

Frequently asked questions

Am I affected by the OpenCode incident?

You are affected if you ran OpenCode 1.0.137 through 1.18.32 on Windows or inside WSL, had a remote MCP server configured, and started its OAuth sign-in (for example opencode mcp auth). A server that was trustworthy when you added it still matters, since its domain or deployment could later change hands. Run opencode --version and opencode mcp list to see your version and configured servers. Because there is no CVE or advisory, dependency scanners will not report this; check installs directly.

What was exposed in the OpenCode incident?

Code execution with the developer's privileges, and so every credential the user account can read: model provider API keys stored by OpenCode, MCP server tokens, Git and cloud credentials, SSH keys and .env files. Pillar explains the mechanism: during MCP OAuth, OpenCode reads the authorization_endpoint from the server's discovery document and passed it unchecked to the open package (version 10.1.2). On Windows, open builds a PowerShell -EncodedCommand, and PowerShell expands a $(...) subexpression inside the double-quoted target, so an otherwise valid https:// URL can carry a command. Scheme validation does not stop it. No prompt injection or extra user action beyond the normal sign-in is needed. macOS and Linux are not affected because their launchers do not pass the URL through a shell. Pillar's proof of concept writes a file; it reports no exploitation in the wild and proposes CVSS 9.8.

Which keys should I rotate?

Rotate any Anthropic, OpenAI, GitHub credentials that were reachable from affected systems, starting with the ones that can publish code or reach production.

Keep keys out of reach of the next compromised package

BotPassword is in early access. Request an invite and we'll email you when your spot opens.