The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-22813

CVE-2026-22813: OpenCode AI Coding Agent XSS Vulnerability

CVE-2026-22813 is a cross-site scripting flaw in OpenCode AI coding agent allowing arbitrary HTML injection through the markdown renderer. This article covers the technical details, affected versions, and mitigation steps.

Updated: January 22, 2026

CVE-2026-22813 Overview

CVE-2026-22813 is a critical Cross-Site Scripting (XSS) vulnerability in OpenCode, an open source AI coding agent. The vulnerability exists in the markdown renderer used for processing LLM (Large Language Model) responses, which inserts arbitrary HTML directly into the DOM without proper sanitization. The web interface lacks both DOMPurify sanitization and Content Security Policy (CSP) protections, allowing attackers who can control or manipulate LLM responses to achieve JavaScript execution within chat sessions.

Critical Impact

An attacker controlling LLM responses can achieve arbitrary JavaScript execution on the http://localhost:4096 origin, potentially leading to session hijacking, data exfiltration, and further exploitation of the local environment.

Affected Products

  • OpenCode versions prior to 1.1.10
  • OpenCode AI coding agent web interface
  • Systems running OpenCode on localhost port 4096

Discovery Timeline

  • 2026-01-12 - CVE CVE-2026-22813 published to NVD
  • 2026-01-13 - Last updated in NVD database

Technical Details for CVE-2026-22813

Vulnerability Analysis

This vulnerability falls under CWE-79 (Improper Neutralization of Input During Web Page Generation), commonly known as Cross-Site Scripting. The core issue stems from the markdown renderer's failure to sanitize HTML content embedded within LLM responses before inserting them into the Document Object Model (DOM).

When OpenCode receives responses from the AI model, these responses are processed through a markdown renderer to display formatted content to the user. However, the renderer does not employ any HTML sanitization library such as DOMPurify to strip potentially malicious HTML tags and attributes. Furthermore, the web interface running on localhost:4096 operates without a Content Security Policy, which would otherwise serve as a defense-in-depth mechanism to prevent inline script execution even if malicious HTML were injected.

The attack scenario involves manipulating the LLM's output to include malicious JavaScript payloads. This could be accomplished through prompt injection techniques, compromised model responses, or man-in-the-middle attacks on the communication between the client and the AI backend.

Root Cause

The root cause is the absence of input sanitization in the markdown rendering pipeline combined with missing Content Security Policy headers on the web interface. The application trusts LLM responses as safe content and renders them directly without validating or cleaning HTML elements. This trust assumption creates a dangerous pathway where any HTML or JavaScript embedded in model responses will be executed in the browser context.

Attack Vector

The attack vector is network-based and requires user interaction. An attacker must find a way to influence the LLM's response content, which could be achieved through several methods:

  1. Prompt Injection: Crafting inputs that cause the LLM to include malicious HTML/JavaScript in its response
  2. Model Compromise: If the AI model or its API endpoint is compromised, attackers can inject arbitrary content
  3. Network Interception: Man-in-the-middle attacks could modify LLM responses in transit if communications are not properly secured

Once malicious JavaScript executes on the localhost:4096 origin, the attacker gains access to any data and functionality available to that origin, including stored credentials, session tokens, and the ability to make authenticated requests on behalf of the user.

The vulnerability mechanism involves injecting HTML tags such as <script>, <img onerror>, or event handler attributes directly through the markdown renderer. Without sanitization, these elements become active JavaScript execution points when rendered in the browser.

For technical details and proof-of-concept information, refer to the GitHub Security Advisory.

Detection Methods for CVE-2026-22813

Indicators of Compromise

  • Unusual JavaScript execution or network requests originating from the OpenCode web interface
  • LLM responses containing HTML tags such as <script>, <iframe>, or event handlers (onclick, onerror, etc.)
  • Unexpected outbound connections from localhost:4096 to external domains
  • Browser console errors or warnings related to blocked inline scripts (if CSP is added)

Detection Strategies

  • Monitor LLM response content for HTML tags and JavaScript code patterns before rendering
  • Implement logging on the OpenCode web interface to track rendered content and script execution attempts
  • Use browser developer tools or network monitoring to identify suspicious outbound requests from the application
  • Deploy web application firewalls or browser extensions that can detect and alert on XSS patterns

Monitoring Recommendations

  • Enable verbose logging for all LLM interactions and response content
  • Set up alerting for any network requests originating from the OpenCode origin to unexpected external endpoints
  • Monitor for changes to local storage, session storage, or cookies associated with the localhost:4096 origin
  • Consider implementing client-side integrity monitoring to detect DOM manipulation

How to Mitigate CVE-2026-22813

Immediate Actions Required

  • Upgrade OpenCode to version 1.1.10 or later immediately
  • Review recent chat sessions for any suspicious or unexpected content in LLM responses
  • Clear browser cache and local storage associated with the OpenCode application
  • Audit any API keys, credentials, or sensitive data that may have been accessible through the web interface

Patch Information

The vulnerability has been addressed in OpenCode version 1.1.10. The fix is available through the official release channels. Users should upgrade to this version or later to remediate the vulnerability. For detailed patch information and release notes, consult the GitHub Security Advisory.

Workarounds

  • Avoid using the OpenCode web interface until upgraded to the patched version
  • If web interface usage is necessary, disable JavaScript execution in the browser for the localhost:4096 origin using browser extensions
  • Implement a local reverse proxy with CSP headers that block inline script execution
  • Monitor and validate all LLM responses manually before trusting their content
bash
# Example: Adding CSP headers via nginx reverse proxy (temporary workaround)
# Add to nginx configuration for the OpenCode proxy location
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline';" always;

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechOpencode

  • SeverityCRITICAL

  • CVSS Score9.4

  • EPSS Probability0.08%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-22812: OpenCode RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English