/

CVE-2026-43900

Severity:

CRITICAL RISK

(9.3)

Cross-Site Scripting (XSS) in DeepChat SvgArtifact Component

CVE-2026-43900

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Arbitrary JavaScript Execution in User Browsers

Severity:

CRITICAL RISK

(9.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A stored Cross-Site Scripting (XSS) vulnerability in DeepChat's SVG handling allows attackers to execute arbitrary JavaScript in users' browsers by bypassing the SVGSanitizer with HTML entity–encoded payloads.

When a crafted SVG artifact is rendered with Vue's v-html in the SvgArtifact.vue component, the browser decodes the entities after the backend sanitizer has run, enabling unexpected script execution in victims' sessions.

Affected context

This vulnerability arises in DeepChat deployments that accept, store, or display user-provided SVG artifacts that are subsequently rendered in the browser.

The affected path involves:

  • SVG content passing through SVGSanitizer (src/main/lib/svgSanitizer.ts) which uses regex-based checks
  • The sanitized SVG being bound into the DOM via Vue's v-html in SvgArtifact.vue

The issue appears when the browser's HTML entity decoding behavior diverges from the sanitizer's plain-text assumptions, allowing previously hidden script protocols to become active after rendering.

Exploit preconditions

  • Attack surface: Web UI where SVG artifacts or images are uploaded, generated, or otherwise supplied and later viewed by other users.
  • Required access: Ability to submit or influence SVG content that DeepChat will store or render (e.g., as an artifact, message attachment, or tool output).
  • Trigger point: A victim user (including administrators or operators) loads a page where the malicious SVG artifact is rendered via v-html, causing the browser to decode HTML entities and interpret script URLs.
  • Why exploitation is possible: The SVGSanitizer relies on plain-text regular expressions to scrub javascript: protocols but does not normalize or decode HTML entities before validation. Vue's v-html then injects the sanitized-but-encoded SVG string into the DOM, where the browser performs entity decoding, reconstituting active script URLs that the sanitizer never saw in their executable form.

Why this happens

The underlying bug is a context mismatch between server-side/logic-layer sanitization and client-side rendering semantics.

The SVGSanitizer implements allow/deny rules using regular expressions over raw SVG strings, assuming that dangerous constructs like javascript: will appear in a straightforward textual form.

However, HTML and SVG specifications permit characters to be encoded using numeric or named entities (e.g., javascript:), which the browser decodes during DOM construction.

Because the sanitizer does not normalize or decode these entities before applying its regex checks, it fails to recognize obfuscated script URLs that become dangerous only after decoding.

This maps to CWE-79 (Improper Neutralization of Input During Web Page Generation), specifically a variant where sanitization does not align with downstream decoding and rendering behavior, leaving a gap attackers can exploit to inject script into the final page.

Potential impact

  • Execution of arbitrary JavaScript in the context of the DeepChat web application.
  • Theft or exposure of session tokens, API keys, or other sensitive information accessible to the victim's browser.
  • Unauthorized actions performed on behalf of victims (e.g., modifying configurations, triggering agent runs, or exfiltrating chat content).
  • Manipulation or poisoning of AI agent conversations, tool outputs, or stored artifacts viewed by other users.
  • Establishment of long-lived browser hooks or beacons for further attacks (e.g., keylogging or cross-tenant data leakage where applicable).

General mitigation guidance

Effective mitigation typically centers on eliminating the trust gap between sanitization and rendering and avoiding unsafe DOM insertion patterns:

  • Normalize and canonicalize SVG/HTML input before validation, including decoding HTML entities and URL-encoding, so sanitization logic operates on the same representation the browser will interpret.
  • Use robust, context-aware SVG/HTML sanitization libraries that understand the full parsing rules of browsers, rather than relying on ad hoc regular expressions.
  • Avoid direct innerHTML-style insertion (v-html) for user-controlled or agent-generated content; prefer safe, templated rendering or DOM construction via vetted libraries.
  • Restrict SVG capabilities where possible by disallowing scripts, external resources, and event handlers, focusing on a minimal subset of safe elements and attributes.
  • Apply a defense-in-depth model: even after sanitization, isolate untrusted content in sandboxed iframes, use strict Content Security Policy (CSP) to block inline scripts and javascript: URLs, and limit ambient access to sensitive data.
  • Minimize the privileges and data accessible from any single browser context, so that a successful XSS yields the least possible damage.

How teams detect issues like this

Detection approaches can combine code-level analysis with runtime monitoring:

  • Static analysis: Search for uses of v-html, innerHTML, or similar sinks where data derived (directly or indirectly) from user or agent-controlled SVG/HTML is inserted into the DOM. Flag cases where sanitization is regex-based, lacks normalization, or does not consider entity decoding.
  • Pattern-based rules: Implement checks in linters or SAST tools that specifically look for javascript: protocol handling in sanitizers and verify that canonicalization (HTML entity decoding, URL normalization) occurs before validation.
  • Code review signals: During manual review, treat any custom sanitizer as suspicious, especially for complex formats like SVG. Reviewers should verify that sanitization logic is aligned with browser parsing rules and that rendering uses safe patterns instead of raw HTML injection.
  • Runtime monitoring: Instrument CSP violation reporting endpoints to capture attempts to load javascript: URLs, inline scripts, or other blocked resources from pages rendering SVG artifacts, which may indicate exploitation attempts.
  • Automated regression tests: Maintain a suite of adversarial SVG and HTML payloads (including entity-encoded scripts) that are run against the sanitizer and UI rendering pipeline in CI to prevent reintroduction of similar flaws.

Sources

SourceLink
github.comgithub.com/ThinkInAIXYZ/deepchat/security/advisories/GHSA-7r59-67v3-3mgp

Frequently asked

questions

The vulnerability is highly exploitable if users or integrated tools can upload or generate SVG artifacts that are then viewed by other users. Once a malicious SVG is accepted and rendered, JavaScript runs in the victim's browser with the privileges of that session, giving attackers broad control over in-app actions and data the user can access.

It depends on how the deployment exposes SVG artifact creation. If only authenticated users or trusted tools can submit SVGs, the attacker must control such an account or integration. If any external party can influence SVG content that the platform stores and displays (even indirectly, such as via shared artifacts), the bar for exploitation is lower. In all cases, the key requirement is the ability to cause a malicious SVG to be rendered in another user's browser.

The most robust pattern is to treat SVG/HTML as hostile by default: avoid direct v-html or innerHTML with untrusted content, normalize inputs before sanitization, and rely on well-maintained, context-aware sanitization libraries rather than hand-written regexes. Combine this with strict CSP and optional sandboxing of untrusted SVGs to substantially limit XSS risk.

Prevention relies on a secure-by-design approach to rich content: ensure that input validation mirrors browser parsing behavior, centralize sanitization logic instead of scattering ad hoc filters, and prohibit raw HTML injection for any user-influenced data. Incorporate automated security testing (including XSS payload suites) and SAST/linters into CI pipelines, and establish coding guidelines that discourage direct DOM HTML insertion in favor of safe component-based rendering.

Find out what's already
exploitable in your codebase.