Datadog Security Labs and Anomaly disclosed on 24 September 2026 that opencode serve and opencode web, in npm, pnpm or Bun installs of OpenCode 1.14.30 through 1.18.21, exposed a /global/upgrade endpoint that accepted any npm package specifier and did not check the request's origin. A webpage could make the browser post to it and install an attacker's package, running its install scripts with the user's access to keys and tokens. The fix is in 1.18.22; no CVE was assigned.
| Disclosed | September 24, 2026 |
|---|---|
| Affected | OpenCode, opencode-ai, Anomaly |
| Type | AI agent |
| Status | Resolved |
What was exposed
Code execution as the user running OpenCode, and with it everything that account can read: provider API keys configured for OpenCode, Git and cloud credentials, SSH keys and .env files. When OpenCode is installed through an npm-compatible manager, the endpoint ran the equivalent of npm install -g opencode-ai@<target>, and npm accepts a remote tarball URL as the target. Because the server parsed a text/plain body as JSON and did not check Origin, a cross-site HTML form could submit the request. The advisory says password protection with OPENCODE_SERVER_PASSWORD did not help once the browser had cached the Basic credentials, since a top-level form navigation sends them. Datadog's write-up shows code execution through a package preinstall script; it does not report credential theft or exploitation in the wild.
Am I affected?
You are affected only if all of these held: you ran OpenCode 1.14.30 to 1.18.21; you used opencode serve or opencode web; OpenCode was installed with npm, pnpm or Bun (curl, Homebrew, Chocolatey and Scoop installs are not affected); the server had no password or the browser had cached it; and you visited an attacker-controlled page while it ran. Datadog suggests checking the install method with ls -l "$(command -v opencode)". Look in global npm packages for an opencode-ai install that did not come from the npm registry.
What to do now
- Update OpenCode to 1.18.22 or later.
- Set
OPENCODE_SERVER_PASSWORDwhenever you run the OpenCode server, especially on a network. - If you ran an affected server while browsing untrusted sites, check that your global
opencode-aiinstall came from the npm registry and rotate provider API keys and tokens on the machine. - Stop
opencode servewhen you are not using it.
Keys to rotate
Guides to the credentials this incident put at risk:
Timeline
- OpenCode 1.14.30, the first affected release, ships, according to Datadog. Source
- Datadog Security Labs reports the issue through a GitHub security advisory. Source
- Anomaly merges the fix (PR #44686) and publishes OpenCode 1.18.22, then asks Datadog to delay publication by a month. Source
- Anomaly publishes GHSA-632h-h47v-g4x4 (high) and Datadog publishes its write-up; Datadog notes that 38.9% of OpenCode npm downloads from 17 to 23 September were still vulnerable versions. Source
Indicators
From the advisories listed below. Use them to search your logs, lockfiles and workflow runs.
- POST requests to
/global/upgradewith atargetthat is a URL rather than a version number. - A globally installed
opencode-airesolved from a non-registry tarball.
What this changes for credential handling
- A self-update endpoint on a local agent server became a package-install primitive for any website. BotPassword is built so that compromising the agent's process does not also give access to the user's stored keys.
Frequently asked questions
Am I affected by the OpenCode incident?
You are affected only if all of these held: you ran OpenCode 1.14.30 to 1.18.21; you used opencode serve or opencode web; OpenCode was installed with npm, pnpm or Bun (curl, Homebrew, Chocolatey and Scoop installs are not affected); the server had no password or the browser had cached it; and you visited an attacker-controlled page while it ran. Datadog suggests checking the install method with ls -l "$(command -v opencode)". Look in global npm packages for an opencode-ai install that did not come from the npm registry.
What was exposed in the OpenCode incident?
Code execution as the user running OpenCode, and with it everything that account can read: provider API keys configured for OpenCode, Git and cloud credentials, SSH keys and .env files. When OpenCode is installed through an npm-compatible manager, the endpoint ran the equivalent of npm install -g opencode-ai@<target>, and npm accepts a remote tarball URL as the target. Because the server parsed a text/plain body as JSON and did not check Origin, a cross-site HTML form could submit the request. The advisory says password protection with OPENCODE_SERVER_PASSWORD did not help once the browser had cached the Basic credentials, since a top-level form navigation sends them. Datadog's write-up shows code execution through a package preinstall script; it does not report credential theft or 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
- 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
- Claude Code could send Anthropic API keys to a malicious repo's endpoint before the trust prompt 2026-01-20