Developers using the OpenCode AI coding agent on Windows or Windows Subsystem for Linux (WSL) were exposed to arbitrary code execution every time they signed in — and the trigger wasn't a memory corruption bug or a phishing lure. It was a trusted integration point: the Model Context Protocol (MCP) servers OpenCode connects to in order to extend the agent with external tools. Anomaly, the company behind OpenCode, shipped a fix in version 1.18.33 in September 2026. Anything running an earlier build needs to be treated as exposed.
This is a supply-chain-shaped vulnerability living inside the developer workstation. Because OpenCode authenticates to and trusts configured MCP servers, a malicious server — or a legitimate one that has been hijacked — could push code that executes with the developer's own privileges at the moment of sign-in. That means access to source code, SSH keys, cloud credentials, CI tokens, and everything else a developer account touches. For organizations that have rapidly adopted AI coding assistants, this is exactly the attack surface your threat model probably hasn't caught up with yet.
No public CVE identifier has been assigned in the reporting at time of writing, and no in-the-wild exploitation has been confirmed. But the exploitation prerequisites are trivially low — control of a configured MCP server endpoint — and developer workstations are among the highest-value targets in any enterprise. Treat this as urgent.
Technical Analysis
Affected Products and Platforms
| Attribute | Detail |
|---|---|
| Product | OpenCode AI coding agent (Anomaly) |
| Affected versions | All versions prior to 1.18.33 |
| Fixed version | 1.18.33 (released September 2026) |
| Platforms | Windows, Windows Subsystem for Linux (WSL) |
| Affected component | MCP server connection / sign-in handling |
| Privilege context | Code executes as the signed-in developer |
How the Attack Works
OpenCode, like most modern AI coding agents, uses MCP to connect to external tool providers. MCP servers advertise tools and capabilities to the agent; the agent trusts these servers as extensions of its own functionality. The flaw was in how OpenCode handled MCP server interactions during the sign-in flow: a malicious or compromised MCP server could cause code to execute on the developer's machine at authentication time — before the developer had any opportunity to review, approve, or even observe the activity.
From a defender's perspective, the attack chain looks like this:
- Precondition: The developer's OpenCode configuration references an MCP server the attacker controls or has compromised. This can happen through a poisoned configuration file, a typosquatted or lookalike MCP server package, a compromised upstream MCP project, or a hijacked server endpoint.
- Trigger: The developer signs in to OpenCode. The agent initiates its normal MCP handshake with configured servers.
- Execution: The malicious server delivers a payload that OpenCode executes locally — on Windows natively, or into the WSL environment for WSL-based setups.
- Impact: The payload runs with the developer's full user context: access to repositories,
~/.ssh, cloud CLI credential caches (Azure CLI, AWS, gcloud), browser profiles, and any connected build/deploy infrastructure.
Exploitation Status
- Confirmed active exploitation: None reported at time of publication.
- Public PoC: None confirmed in reporting.
- CISA KEV: Not listed.
- Assessment: The vulnerability is patched, but the technique class — abuse of MCP server trust in AI agent tooling — is an emerging attack surface that defenders should expect to see weaponized. The window of exposure for unpatched installs is significant given how quietly developer tools auto-update (or don't).
Why This Matters Beyond OpenCode
Even after patching, the underlying lesson stands: MCP servers are effectively remote code providers for AI agents. Every MCP server in a developer's configuration is a supply-chain dependency with execution-equivalent trust. Your inventory, change control, and monitoring need to treat them that way.
Detection & Response
The highest-fidelity detection opportunities center on OpenCode spawning unexpected child processes at or near sign-in/startup, unexpected modifications to MCP configuration, and outbound connections to non-standard MCP endpoints. The rules below are tuned to be useful in a real SOC — they key off the OpenCode process as parent, which dramatically cuts noise.
Sigma Rules
---
title: OpenCode Agent Spawning Shell or Script Interpreter
description: Detects the OpenCode AI coding agent spawning command shells or script interpreters, consistent with malicious MCP server-driven code execution at sign-in.
references:
- https://thehackernews.com/2026/10/opencode-flaw-lets-malicious-mcp.html
- https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/10/20
status: experimental
id: 4f8c2e71-9a3b-4d5e-b6f1-2c7d8e9a0b1c
tags:
- attack.execution
- attack.t1059
logsource:
category: process_creation
product: windows
detection:
selection_parent:
ParentImage|endswith:
- '\opencode.exe'
- '\opencode'
selection_child:
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\pwsh.exe'
- '\wscript.exe'
- '\cscript.exe'
- '\mshta.exe'
- '\rundll32.exe'
- '\wsl.exe'
- '\bash.exe'
condition: selection_parent and selection_child
falsepositives:
- Legitimate MCP servers that execute developer-approved local tooling (e.g., build or test runners)
level: high
---
title: OpenCode MCP Configuration Modified Outside Expected Paths
description: Detects creation or modification of OpenCode/MCP configuration files by processes other than the OpenCode agent or the user's editor, indicating potential MCP server injection.
references:
- https://thehackernews.com/2026/10/opencode-flaw-lets-malicious-mcp.html
- https://attack.mitre.org/techniques/T1195/
author: Security Arsenal
date: 2026/10/20
status: experimental
id: 8b3d1f62-4c5a-4e7b-9d2a-1f3e5c7b9d0a
tags:
- attack.supply_chain_compromise
- attack.t1195.002
- attack.persistence
logsource:
category: file_event
product: windows
detection:
selection_path:
TargetFilename|contains:
- 'opencode.json'
- '\.opencode\'
- 'mcp.json'
- 'mcp_settings'
filter_legit:
Image|endswith:
- '\opencode.exe'
- '\Code.exe'
- '\code-insiders.exe'
- '\notepad++.exe'
- '\devenv.exe'
condition: selection_path and not filter_legit
falsepositives:
- Manual editing with non-listed editors; add your team's standard editors to the filter
level: medium
---
title: WSL Bash Execution Initiated by Windows-Side OpenCode
description: Detects OpenCode on Windows launching wsl.exe or bash.exe to execute commands inside WSL, matching the WSL-side execution path of this vulnerability.
references:
- https://thehackernews.com/2026/10/opencode-flaw-lets-malicious-mcp.html
- https://attack.mitre.org/techniques/T1059.004/
author: Security Arsenal
date: 2026/10/20
status: experimental
id: 2e6a9c45-7d1f-4b8e-a3c6-5f9b2d4e7a1f
tags:
- attack.execution
- attack.t1059.004
logsource:
category: process_creation
product: windows
detection:
selection_parent:
ParentImage|endswith:
- '\opencode.exe'
- '\opencode'
selection_exec:
Image|endswith:
- '\wsl.exe'
- '\bash.exe'
selection_args:
CommandLine|contains:
- '-e '
- '--exec'
- 'bash -c'
- 'sh -c'
- 'curl'
- 'wget'
- 'Invoke-'
- 'base64'
condition: selection_parent and selection_exec and selection_args
falsepositives:
- Developer-approved MCP tooling that shells into WSL for builds; review CommandLine before tuning out
level: high
Microsoft Sentinel / Defender KQL
This hunt identifies OpenCode child-process execution clustered around sign-in events, plus the network connections those child processes make — the combination that separates malicious MCP behavior from normal agent activity.
// Hunt: OpenCode spawning interpreters/downloaders and their network activity
let Lookback = 14d;
let SuspiciousChildren = dynamic(["cmd.exe","powershell.exe","pwsh.exe","wsl.exe","bash.exe","mshta.exe","rundll32.exe","curl.exe","wget.exe","certutil.exe","bitsadmin.exe"]);
let ProcEvents =
DeviceProcessEvents
| where TimeGenerated > ago(Lookback)
| where InitiatingProcessFileName =~ "opencode.exe" or InitiatingProcessFileName =~ "opencode"
| where FileName in~ (SuspiciousChildren)
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessCommandLine, ProcessId, SHA256;
ProcEvents
| join kind=leftouter (
DeviceNetworkEvents
| where TimeGenerated > ago(Lookback)
| where InitiatingProcessFileName in~ (SuspiciousChildren)
| project DeviceName, InitiatingProcessId, RemoteUrl, RemoteIP, RemotePort, NetTime=TimeGenerated
) on $left.ProcessId == $right.InitiatingProcessId and $left.DeviceName == $right.DeviceName
| extend IsCloudOrCommonMcp = RemoteUrl has_any ("github.com","npmjs.com","anthropic.com","modelcontextprotocol") or isempty(RemoteUrl)
| where not(IsCloudOrCommonMcp) or ProcessCommandLine has_any ("base64","Invoke-","DownloadString","curl","wget","bash -c")
| summarize Executions = count(), DistinctRemoteHosts = dcount(RemoteIP)
by DeviceName, AccountName, FileName, ProcessCommandLine, RemoteUrl, RemoteIP
| order by Executions desc;
For environments ingesting WSL syslog into Sentinel, add a companion hunt for shells inside WSL whose parent chain traces to an unexpected source:
// Hunt: Suspicious shell execution inside WSL distributions
Syslog
| where TimeGenerated > ago(14d)
| where Computer has_any ("wsl","WSL") or Facility == "user"
| where SyslogMessage has_any ("bash -c", "sh -c", "curl |", "wget |", "base64 -d")
| extend CmdLine = extract(@"(?:bash|sh) -c ['\"]?(.*?)['\"]?$", 1, SyslogMessage)
| where isnotempty(CmdLine)
| summarize count() by Computer, CmdLine, bin(TimeGenerated, 1h)
| order by count_ desc;
Velociraptor VQL
Use this artifact for fleet-wide hunting across Windows developer workstations — it enumerates OpenCode-spawned processes and checks for MCP configuration files modified recently, giving you both live execution evidence and persistence evidence in one sweep.
-- Hunt: OpenCode child processes and recently modified MCP config artifacts
SELECT * FROM foreach(
row={
SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
},
query={
SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime,
ParentName.Name AS ParentProcess
FROM scope()
JOIN (SELECT Pid AS PPid2, Name FROM pslist()) AS ParentName
ON Ppid = ParentName.PPid2
WHERE ParentProcess =~ '(?i)opencode'
AND Name =~ '(?i)(cmd|powershell|pwsh|wsl|bash|mshta|rundll32|curl|wget|certutil)'
})
UNION ALL
SELECT * FROM foreach(
row={
SELECT OSPath, Mtime, Size
FROM glob(globs=[
'C:/Users/*/.opencode/**',
'C:/Users/*/AppData/*/opencode/**',
'C:/Users/*/**/mcp.json',
'C:/Users/*/**/opencode.json'
])
WHERE Mtime > now() - 1209600 -- modified in last 14 days
},
query={
SELECT NULL AS Pid, NULL AS Ppid, 'CONFIG_ARTIFACT' AS Name,
OSPath AS CommandLine, NULL AS Exe, NULL AS Username,
Mtime AS CreateTime, NULL AS ParentProcess
FROM scope()
})
Remediation Script
Run this PowerShell script (as administrator for fleet deployment, or per-developer via your RMM) to inventory OpenCode installs, flag vulnerable versions, and surface MCP configuration for review.
# OpenCode MCP Flaw - Version Audit and MCP Config Inventory
$MinSafeVersion = [version]"1.18.33"
$report = @()
# Locate OpenCode installs (per-user and machine-wide)
$searchPaths = @(
"$env:LOCALAPPDATA\Programs\opencode",
"$env:ProgramFiles\opencode",
"${env:ProgramFiles(x86)}\opencode",
"$env:USERPROFILE\.opencode"
) | Where-Object { Test-Path $_ }
$opencodeExe = $searchPaths | ForEach-Object {
Get-ChildItem -Path $_ -Recurse -Filter "opencode.exe" -ErrorAction SilentlyContinue
}
# Also check PATH resolution
if (-not $opencodeExe) {
$cmd = Get-Command opencode -ErrorAction SilentlyContinue
if ($cmd) { $opencodeExe = Get-Item $cmd.Source }
}
if (-not $opencodeExe) {
Write-Output "[INFO] OpenCode not found on this host."
exit 0
}
foreach ($exe in $opencodeExe) {
$ver = [version]($exe.VersionInfo.ProductVersion -replace '[^0-9.]', '' -split '-' | Select-Object -First 1)
$status = if ($ver -lt $MinSafeVersion) { "VULNERABLE - UPDATE TO 1.18.33+" } else { "PATCHED" }
Write-Output "[$status] $($exe.FullName) - version $ver"
$report += [pscustomobject]@{ Path = $exe.FullName; Version = $ver; Status = $status }
}
# Inventory MCP configuration for manual review
$configLocations = @(
"$env:USERPROFILE\.opencode\opencode.json",
"$env:APPDATA\opencode\opencode.json",
"$env:USERPROFILE\opencode.json"
) | Where-Object { Test-Path $_ }
foreach ($cfg in $configLocations) {
Write-Output "`n[REVIEW] MCP config found: $cfg"
$content = Get-Content $cfg -Raw | ConvertFrom-Json -ErrorAction SilentlyContinue
if ($content.mcp) {
$content.mcp.PSObject.Properties | ForEach-Object {
Write-Output " MCP Server: $($_.Name) -> $($_.Value | ConvertTo-Json -Compress)"
}
}
}
if (($report | Where-Object { $_.Status -like 'VULNERABLE*' })) {
Write-Output "`n[ACTION REQUIRED] Update OpenCode to 1.18.33 or later immediately."
exit 1
}
Remediation
- Update OpenCode to version 1.18.33 or later immediately. This is the authoritative fix from Anomaly, released September 2026. Verify the running binary version on every developer workstation — do not assume auto-update fired. Cross-reference the official release notes at the OpenCode repository and the vendor advisory referenced in the original reporting at The Hacker News.
- Inventory every MCP server in every developer configuration. Pull
opencode.jsonand any MCP config files fleet-wide (the script above does this). Any server that isn't a known, internally approved endpoint should be removed pending review. Treat unknown MCP servers the way you'd treat an unknown browser extension with full disk access. - Establish an MCP allowlist policy. AI coding agents should only connect to organization-approved MCP servers — ideally internally hosted or pinned by version/hash where the ecosystem supports it. Enforce through configuration management and detect drift with the file-monitoring Sigma rule above.
- Rotate credentials if you find evidence of exploitation. If hunting surfaces OpenCode spawning unexpected shells with outbound connections, assume credential exposure on that host: SSH keys, cloud CLI tokens, repository PATs, and browser-stored secrets. Standard IR containment applies.
- Harden WSL boundaries. For WSL-based development, audit what Windows-side processes can execute into WSL (
wsl.exeinvocation patterns) and apply Windows Defender Application Control or AppLocker policies limiting who can invokewsl.exe -e/bash -cchains. - Extend supply-chain controls to AI tooling. Add AI coding agents and their plugin/MCP ecosystems to your software inventory, vendor risk assessments, and patch SLAs. This class of tooling now sits in the critical path of your source code — govern it accordingly.
Related Resources
Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.