/

CVE-2026-23852

Severity:

CRITICAL RISK

(9.6)

Cross-Site Scripting (Stored) in SiYuan Dynamic Icons

CVE-2026-23852

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (Stored)

CWE:

CWE-94, CWE-79

Impact:

Stored XSS with Potential Remote Code Execution in Desktop Environment

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

SiYuan versions prior to 3.5.4 contain a stored Cross-Site Scripting (XSS) vulnerability in the block icon attribute, settable via the /api/attr/setBlockAttrs API.

Malicious HTML attributes injected into this field are later rendered without proper sanitization, enabling stored XSS in the browser and, in the desktop environment, possible remote code execution (RCE) via dynamic icon handling.

Affected context

The vulnerability appears in SiYuan's handling of block attributes, specifically the icon attribute used by the dynamic icon feature.

It affects deployments where:

  • Users or integrations can call /api/attr/setBlockAttrs to update block attributes, and
  • The resulting icon attributes are later rendered into an HTML context without strict sanitization, and
  • In the desktop application, the rendering environment can bridge from script execution to host-level code execution.

Under these conditions, attacker-controlled icon attributes may persist in user content and execute whenever the affected block is viewed.

Exploit preconditions

  • Attack surface: SiYuan instances that expose or use the /api/attr/setBlockAttrs API for updating block attributes.
  • Required access: Ability to create or modify content blocks or invoke the attribute-setting API with attacker-controlled values; this may require a valid user session or compromised integration.
  • Trigger point: Viewing or rendering a block whose icon attribute contains malicious HTML attributes in the dynamic icon feature.
  • Why exploitation is possible: The icon attribute is treated as partially trusted and inserted into an HTML context without robust escaping or sanitization of attribute values, allowing script-capable attributes or constructs to execute and, in the desktop environment, to escalate to RCE.

Why this happens

The issue stems from treating a user-controlled attribute (icon) as safe for direct insertion into the DOM or equivalent rendering context.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (XSS) because attacker-controlled data is rendered without sufficient encoding or sanitization.

In the desktop setting, the executed script can gain access to APIs or integrations that allow running arbitrary code, effectively crossing into CWE-94: Improper Control of Generation of Code, as untrusted content indirectly controls the generation or execution of native code.

The previous fix for issue #15970 did not fully constrain what could be injected into the icon attributes, leaving a bypass path that still allowed dangerous attribute patterns to reach the rendering layer.

Potential impact

  • Persistent execution of attacker-controlled JavaScript in affected SiYuan sessions (stored XSS).
  • Account takeover within the application context via session hijacking or credential harvesting.
  • Unauthorized access to or manipulation of stored notes and knowledge-base content.
  • Execution of arbitrary code in the SiYuan desktop environment, potentially compromising the host system.
  • Use of the compromised desktop client as a pivot point for further lateral movement or data exfiltration.

General mitigation guidance

Effective mitigation focuses on strict separation between data and executable content in UI rendering:

  • Treat all user-controlled attributes, including icon, as untrusted and apply context-appropriate encoding (e.g., HTML attribute encoding) before insertion into DOM or template output.
  • Restrict dynamic icon functionality to a safe, well-defined subset of allowed values (e.g., whitelisted icon identifiers rather than raw HTML or attributes).
  • Introduce centralized sanitization routines for any attribute that can impact markup, ensuring that script-like constructs, event handlers, and protocol handlers are stripped or rejected.
  • Reduce the privileges of the desktop runtime so that even if script executes, access to host-level code execution paths is minimized.
  • Favor secure-by-default UI components that do not rely on raw HTML injection for customization.

How teams detect issues like this

Detection can leverage a combination of code-level and behavior-level techniques:

  • Use static analysis or linters to flag patterns where user-controlled values are interpolated into HTML attributes or innerHTML without escaping.
  • During code review, look for API endpoints such as /api/attr/setBlockAttrs that accept free-form strings and trace their flow into rendering code or templating engines.
  • Define security tests that attempt to store representative XSS payloads in icon or similar attributes and then exercise UI paths that render them, checking for script execution.
  • Apply content security policies (CSP) in web contexts and monitor violation reports, which can highlight unexpected inline script execution.
  • Incorporate automated dependency and configuration checks that enforce a rule: no feature should require raw HTML from untrusted sources for basic customization.

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/commit/0be7e1d4e0da9aac0da850b7aeb9b50ede7e5bdb
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-7c6g-g2hx-23vv

Frequently asked

questions

Yes. If an attacker can reach the /api/attr/setBlockAttrs endpoint or otherwise cause malicious icon attributes to be stored, the payload is delivered to any user who later renders the affected block, including over remote sessions.

The attacker typically needs the ability to create or modify blocks or to call the attribute-setting API with their own data. This could come from a compromised user account, malicious plugin, or integration that has write access.

Constrain the icon attribute to a strictly validated data format (e.g., icon names or IDs) and ensure that all rendering uses context-appropriate escaping. Do not allow arbitrary HTML or attributes from user-controlled sources to influence markup or scriptable surfaces.

Adopt a defensive design where all user-generated content is treated as untrusted, enforce centralized output encoding and sanitization, and subject any feature that injects dynamic content into UI templates—especially in desktop/webview contexts—to dedicated security review and automated XSS testing.

Find out what's already
exploitable in your codebase.