VYPR
High severityOSV Advisory· Published Jan 12, 2026· Updated Jan 13, 2026

OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution

CVE-2026-22812

Description

OpenCode is an open source AI coding agent. Prior to 1.0.216, OpenCode automatically starts an unauthenticated HTTP server that allows any local process (or any website via permissive CORS) to execute arbitrary shell commands with the user's privileges. This vulnerability is fixed in 1.0.216.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
opencode-ainpm
< 1.0.2161.0.216

Affected products

1

Patches

1
7d2d87fa2c44

core: allow CORS requests from *.opencode.ai subdomains

https://github.com/anomalyco/opencodeDax RaadDec 30, 2025via ghsa
1 file changed · +16 1
  • packages/opencode/src/server/server.ts+16 1 modified
    @@ -104,7 +104,22 @@ export namespace Server {
               timer.stop()
             }
           })
    -      .use(cors())
    +      .use(
    +        cors({
    +          origin(input) {
    +            if (!input) return
    +
    +            if (input.startsWith("http://localhost:")) return input
    +            if (input.startsWith("http://127.0.0.1:")) return input
    +
    +            // *.opencode.ai (https only, adjust if needed)
    +            if (/^https:\/\/([a-z0-9-]+\.)*opencode\.ai$/.test(input)) {
    +              return input
    +            }
    +            return
    +          },
    +        }),
    +      )
           .get(
             "/global/health",
             describeRoute({
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

1