Two advisories published on 12 January 2026 showed that the OpenCode AI coding agent exposed its machine to other software. Before version 1.0.216, OpenCode started an unauthenticated HTTP server with permissive CORS that any local process or website could use to run shell commands and read files as the user (CVE-2026-22812). Before 1.1.10, its web UI rendered model output as raw HTML, giving JavaScript execution on the local origin (CVE-2026-22813). Update OpenCode, and rotate any keys on the machine if you ran an affected version while browsing untrusted sites.
| Disclosed | January 12, 2026 |
|---|---|
| Affected | OpenCode, opencode-ai, Anomaly |
| Type | AI agent |
| Status | Resolved |
| CVE | CVE-2026-22812, CVE-2026-22813 |
What was exposed
The advisory lists the endpoints the unauthenticated server exposed: POST /session/:id/shell to run shell commands, POST /pty to open an interactive terminal, and GET /file/content?path= to read arbitrary files. Anything the user account could read was therefore reachable, including provider API keys in environment variables or config files, ~/.ssh keys, cloud credentials, .env files and Git credentials. Because CORS allowed any origin, the reporter showed a webpage could make these calls through the visitor's browser (confirmed in Firefox; Chrome 142 and later may ask for Local Network Access permission). With the --mdns flag the server bound to all interfaces, extending the exposure to the local network. The second flaw let anyone who could control a chat response, for example through prompt injection, run JavaScript on the http://localhost:4096 origin of the web UI. The advisories do not report exploitation in the wild.
Am I affected?
You are affected if you ran the opencode-ai CLI or desktop app below 1.0.216 (server issue) or below 1.1.10 (web UI issue). Check with opencode --version or npm ls -g opencode-ai. The risk was highest if you visited untrusted websites while OpenCode was running, used --mdns on a shared network, or installed untrusted local packages that could reach 127.0.0.1:4096. There are no published indicators that prove past exploitation, so judge exposure by version and usage.
What to do now
- Update OpenCode to the latest release (at least 1.1.10, which includes both fixes).
- If you ran an affected version while browsing untrusted sites or on a shared network, rotate the provider API keys, Git tokens and cloud credentials that were readable by your user account.
- Avoid
--mdnson networks you do not control, and setOPENCODE_SERVER_PASSWORDwhen you run the server. - Review shell history and recently modified files for commands you did not run.
Keys to rotate
Guides to the credentials this incident put at risk:
Timeline
- The reporter of GHSA-vxw4-wv6m-9hhh says they first emailed the issue to the maintainers on this date and received no response. Source
- OpenCode 1.0.216, the fixed version for the unauthenticated server issue, is published to npm. Source
- OpenCode 1.1.10, the fixed version for the web UI issue, is published to npm. Source
- Anomaly publishes GHSA-vxw4-wv6m-9hhh (high) and GHSA-c83v-7274-4vgp (critical); NVD records CVE-2026-22812 and CVE-2026-22813 the same day. Source
Indicators
From the advisories listed below. Use them to search your logs, lockfiles and workflow runs.
- An OpenCode HTTP server listening on port 4096 or nearby without authentication, in versions below 1.0.216.
- Requests to
/session/:id/shell,/ptyor/file/contentfrom origins other than the OpenCode UI.
What this changes for credential handling
- A local agent server is reachable by every process and, through the browser, every website. BotPassword keeps provider keys out of the agent's readable environment so a local compromise does not hand them over.
Frequently asked questions
Am I affected by the OpenCode incident?
You are affected if you ran the opencode-ai CLI or desktop app below 1.0.216 (server issue) or below 1.1.10 (web UI issue). Check with opencode --version or npm ls -g opencode-ai. The risk was highest if you visited untrusted websites while OpenCode was running, used --mdns on a shared network, or installed untrusted local packages that could reach 127.0.0.1:4096. There are no published indicators that prove past exploitation, so judge exposure by version and usage.
What was exposed in the OpenCode incident?
The advisory lists the endpoints the unauthenticated server exposed: POST /session/:id/shell to run shell commands, POST /pty to open an interactive terminal, and GET /file/content?path= to read arbitrary files. Anything the user account could read was therefore reachable, including provider API keys in environment variables or config files, ~/.ssh keys, cloud credentials, .env files and Git credentials. Because CORS allowed any origin, the reporter showed a webpage could make these calls through the visitor's browser (confirmed in Firefox; Chrome 142 and later may ask for Local Network Access permission). With the --mdns flag the server bound to all interfaces, extending the exposure to the local network. The second flaw let anyone who could control a chat response, for example through prompt injection, run JavaScript on the http://localhost:4096 origin of the web UI. The advisories do not report exploitation in the wild.
Other ai agent and mcp incidents
- OpenCode on Windows and WSL ran commands from a malicious MCP server during OAuth sign-in 2026-10-04
- OpenCode server's upgrade endpoint let any webpage install an attacker's npm package 2026-09-24
- Cursor before 3.0: prompt-injected agent could escape its sandbox and run code as the user 2026-06-05
- Claude Code trust dialog could be bypassed with a spoofed git worktree, running repo hooks 2026-04-24
- Claw Chain: four OpenClaw flaws let a foothold read agent secrets and escape the sandbox 2026-04-23
- OpenClaw Control UI sent its gateway token to any gatewayUrl in a link, enabling 1-click RCE 2026-01-31