# OpenCode local HTTP server let websites and local processes run commands and read files

Source: https://botpassword.com/incidents/2026-01-opencode-local-server-command-execution
Disclosed: 2026-01-12 · Type: AI agent · Status: Resolved · Updated: 2026-10-25

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.

Identifiers: CVE-2026-22812, CVE-2026-22813, GHSA-vxw4-wv6m-9hhh, GHSA-c83v-7274-4vgp

## 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.

## Who is 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

1. Update OpenCode to the latest release (at least 1.1.10, which includes both fixes).
2. 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.
3. Avoid `--mdns` on networks you do not control, and set `OPENCODE_SERVER_PASSWORD` when you run the server.
4. Review shell history and recently modified files for commands you did not run.

## Keys to rotate

- [Anthropic](https://botpassword.com/keys/anthropic)
- [OpenAI](https://botpassword.com/keys/openai)
- [GitHub](https://botpassword.com/keys/github)

## Timeline

- 2025-11-17: The reporter of GHSA-vxw4-wv6m-9hhh says they first emailed the issue to the maintainers on this date and received no response. ([source](https://github.com/anomalyco/opencode/security/advisories/GHSA-vxw4-wv6m-9hhh))
- 2025-12-30: OpenCode 1.0.216, the fixed version for the unauthenticated server issue, is published to npm. ([source](https://www.npmjs.com/package/opencode-ai?activeTab=versions))
- 2026-01-09: OpenCode 1.1.10, the fixed version for the web UI issue, is published to npm. ([source](https://www.npmjs.com/package/opencode-ai?activeTab=versions))
- 2026-01-12: 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](https://github.com/anomalyco/opencode/security/advisories/))

## Indicators

- An OpenCode HTTP server listening on port 4096 or nearby without authentication, in versions below 1.0.216.
- Requests to `/session/:id/shell`, `/pty` or `/file/content` from origins other than the OpenCode UI.

## Sources

- https://github.com/anomalyco/opencode/security/advisories/GHSA-vxw4-wv6m-9hhh
- https://github.com/anomalyco/opencode/security/advisories/GHSA-c83v-7274-4vgp
- https://nvd.nist.gov/vuln/detail/CVE-2026-22812
- https://nvd.nist.gov/vuln/detail/CVE-2026-22813
- https://www.npmjs.com/package/opencode-ai?activeTab=versions
