OpenCode: RCE via a malicious website
Attack Techniques & Methods2026-10-14, 10:07
Datadog Security Labs discovered GHSA-632h-h47v-g4x4 in OpenCode, an AI coding agent.
The
POST /global/upgrade endpoint accepted a URL pointing to a malicious npm package tarball instead of a version number. When OpenCode had been installed using npm, pnpm, or Bun, the corresponding package manager could install the attacker-controlled package and execute its preinstall script.A second flaw enabled exploitation from a malicious website: the API parsed the request body as JSON regardless of its
Content-Type. An HTML form using enctype="text/plain" could submit specially crafted JSON through a top-level navigation, which was not blocked by CORS or Local Network Access protections in the demonstrated scenario.Impact: visiting a malicious webpage could trigger code execution on the developer's machine.
Conditions: OpenCode versions 1.14.30–1.18.21, installation through npm/pnpm/Bun, a running
opencode serve or opencode web instance, and either no password authentication or cached browser credentials.Fixed in: OpenCode 1.18.22.
Vendors
Products