/

CVE-2026-32626

Severity:

CRITICAL RISK

(9.6)

XSS in AnythingLLM Desktop Chat Rendering Pipeline Leading

CVE-2026-32626

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Remote Code Execution via Cross-Site Scripting in Electron

Severity:

CRITICAL RISK

(9.6)

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

AnythingLLM Desktop before 1.11.2 contains a cross-site scripting (XSS) flaw in the live chat rendering path that allows untrusted content to be injected into the DOM during streaming.

Because the Electron shell is configured insecurely, an attacker who can control streamed chat content can escalate this XSS into remote code execution on the underlying host with no extra user interaction beyond normal chat usage.

Affected context

This vulnerability occurs in the AnythingLLM Desktop application's chat UI when messages are rendered during the streaming phase.

The issue specifically affects the custom markdown-it image renderer in frontend/src/utils/chat/markdown.js, which injects token.content directly into an alt attribute, and the PromptReply component, which renders this HTML via dangerouslySetInnerHTML without sanitization.

In contrast, historical messages use DOMPurify.sanitize() correctly, so the risk is concentrated in the live, streaming chat path under default Electron settings.

Exploit preconditions

  • Attack surface: Desktop chat interface running inside an Electron shell.
  • Required access: Ability to cause malicious content to appear in a streamed chat message (e.g., through prompt injection, external integrations, shared workspaces, or malicious upstream data sources).
  • Trigger point: Rendering of a streaming chat response in the PromptReply component, which uses dangerouslySetInnerHTML on unsanitized HTML produced by the custom markdown renderer.
  • Why exploitation is possible:
  • The markdown-it image renderer interpolates token.content directly into an HTML attribute without HTML entity escaping.
  • PromptReply bypasses DOMPurify and trusts this HTML, leading to XSS.
  • The Electron environment is configured insecurely (e.g., nodeIntegration or similar bridging features), allowing XSS to pivot into arbitrary code execution on the host.

Why this happens

The underlying bug is a classic reflected/DOM-based XSS pattern where untrusted text is converted to HTML and injected into the DOM without proper escaping or sanitization.

Specifically:

  • The custom markdown-it renderer constructs an <img> tag by concatenating raw token.content into the alt attribute.
  • This output is then rendered using React's dangerouslySetInnerHTML in PromptReply, bypassing React's built-in escaping and omitting any sanitization step such as DOMPurify.

Within an Electron context configured with powerful web preferences, this maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting) and effectively becomes an XSS-to-RCE chain because DOM JavaScript execution can access sensitive Electron APIs or preload bridges.

Potential impact

  • Remote execution of arbitrary commands or code on the host operating system via the Electron runtime.
  • Exfiltration of local files and sensitive data accessible to the AnythingLLM Desktop app.
  • Theft of API keys, access tokens, and credentials stored or used by the application.
  • Manipulation of chat content, prompt history, and retrieved context to poison outputs or mislead users.
  • Use of the compromised desktop client as a pivot to attack other internal systems reachable from the host.

General mitigation guidance

Effective mitigation focuses on both the HTML rendering pipeline and the Electron security model:

  • Ensure all user-controlled or model-controlled content is sanitized before being inserted into the DOM, including streaming content paths; apply a robust HTML sanitizer such as DOMPurify consistently across components.
  • Avoid using dangerouslySetInnerHTML for rich text rendering where possible; prefer structured rendering that escapes content by default.
  • When custom markdown renderers are necessary, properly escape or encode all interpolated values, especially within HTML attributes, and avoid raw string concatenation.
  • Harden the Electron configuration following least-privilege principles: disable or strictly limit node integration, remote module access, and any direct bridging that lets web content execute OS-level commands.
  • Place sensitive capabilities (file access, shell execution, key handling) behind narrow, validated IPC interfaces and treat the renderer process as untrusted.

How teams detect issues like this

Detection can rely on a combination of code-centric and configuration-centric approaches:

  • Static analysis rules or linters that flag:
  • Uses of dangerouslySetInnerHTML or similar raw HTML injection APIs.
  • Custom markdown or HTML rendering logic that concatenates untrusted data into tags or attributes without escaping.
  • Code review checklists that:
  • Require DOMPurify (or equivalent) on any path rendering user- or model-controlled HTML.
  • Explicitly review Electron BrowserWindow and webPreferences configuration for unsafe settings (e.g., nodeIntegration: true, contextIsolation: false).
  • Security-focused unit and integration tests for the chat UI that attempt to inject script-like payloads into streaming responses and confirm they are neutralized.
  • Periodic automated scanning of the codebase with SAST tools tuned for XSS-in-Electron patterns and insecure Electron preferences.

Sources

SourceLink
github.comgithub.com/Mintplex-Labs/anything-llm/commit/9e2d144dc8be6fab29f560f5bcdaa9ef7dbb4214
github.comgithub.com/Mintplex-Labs/anything-llm/security/advisories/GHSA-rrmw-2j6x-4mf2

Frequently asked

questions

Yes. If an attacker can influence streamed chat content—for example via prompt injection, compromised upstream data, or shared workspace input—they can trigger the XSS remotely and, in an insecure Electron configuration, escalate to code execution on the victim's machine.

The attacker needs a way to control or meaningfully influence content that appears in the streaming chat response. They do not need local access to the machine or additional user clicks beyond ordinary chat interactions.

Apply a consistent HTML sanitization layer (such as DOMPurify) to all rendered chat content, including streaming responses, avoid dangerouslySetInnerHTML where feasible, and refactor rendering to use safe, structured components. In parallel, harden the Electron environment so that even if XSS occurs, the renderer process cannot directly run OS commands.

Establish a standard pattern for rendering untrusted content (centralized sanitizer + safe components), enforce secure coding guidelines around markdown/HTML rendering and Electron configuration, and integrate automated checks (linters, SAST, and CI policies) that block unsafe patterns like unchecked dangerouslySetInnerHTML or permissive webPreferences.

Find out what's already
exploitable in your codebase.