CVE-2026-22813: OpenCode AI XSS Vulnerability Allows Remote Command Execution
Summary
CVE-2026-22813: Malicious website can execute commands on the local system through XSS in the OpenCode web UI. Affects opencode-ai versions < 1.1.10. Fixed in 1.1.10. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
OpenCode AI is an open-source tool designed for collaborative coding and AI-assisted programming. It features a web UI that allows users to interact with the application through a browser. The application runs a local HTTP server on localhost:4096, exposing various API endpoints for functionality. However, the web UI's lack of proper input sanitization has made it susceptible to cross-site scripting (XSS) attacks, which can lead to severe security risks.
Vulnerability Detail
The vulnerability arises from the OpenCode web UI's server URL override feature, which can be exploited by a malicious website to execute arbitrary JavaScript on the localhost. This XSS vulnerability allows attackers to run commands on the local system through the OpenCode API's /pty/ endpoints. The absence of sanitization mechanisms, such as DOMPurify or Content Security Policy (CSP), further exacerbates the risk, enabling attackers to inject malicious scripts into the web interface.
How To Fix
Latest published version: 1.19.4 as of 23 Oct 2026
npm install opencode-ai@1.19.4
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.1.10
This is the first release that contains the fix.
npm install opencode-ai@1.1.10
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can disable the web UI and API endpoints to reduce the attack surface of the application. This can be done by not starting the OpenCode server or by configuring it to restrict access.
Conclusion
The CVE-2026-22813 vulnerability in OpenCode AI poses a significant risk due to its potential for remote command execution via XSS. Users are strongly encouraged to upgrade to version 1.1.10 or later to mitigate this risk. Temporary workarounds can be employed, but upgrading is the most effective solution.
See every vulnerability recorded for opencode-ai →
FAQ
The CVSS score of this vulnerability is 9.4, indicating a critical severity level.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can check if your application is affected by visiting the Vulert playground at Vulert Scanner without any signup.
If exploited, this vulnerability can allow attackers to execute arbitrary commands on the local system, leading to data breaches, unauthorized access, and potential system compromise.
Yes, users can temporarily disable the web UI and API endpoints to reduce the attack surface until they can upgrade to the patched version.
If immediate upgrading is not possible, ensure that the OpenCode server is not exposed to untrusted networks and consider implementing additional security measures to limit access.
References
Related vulnerabilities
Recent vulnerabilities recorded for opencode-ai.