Discovering and exploiting a remote code execution vulnerability in OpenCode (GHSA-632h-h47v-g4x4)
Datadog demonstrates remote code execution in OpenCode AI coding agent via content-type confusion in the /global/upgrade endpoint, fixed in 1.18.22.
Datadog Security Labs discloses GHSA-632h-h47v-g4x4, a remote code execution flaw in OpenCode, an open-source AI coding agent with over 200,000 GitHub stars and 16 million monthly users. A content-type confusion in the /global/upgrade endpoint lets a malicious webpage send a cross-origin text/plain POST to the unauthenticated local server on 127.0.0.1:4096, supplying an attacker-controlled npm tarball whose preinstall script executes arbitrary code. OpenCode 1.18.22 fixes the vulnerability; users should check their install method and version.