/

CVE-2026-73043

Severity:

CRITICAL RISK

(9.0)

Stored XSS (CWE-79) in SiYuan Template Calculator Engine

CVE-2026-73043

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Remote Code Execution through Stored XSS

Severity:

CRITICAL RISK

(9.0)

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 before 3.7.4 contain a stored cross-site scripting vulnerability in the Template calculation operator, which renders user-authored Go templates and stores their output without sanitization. Malicious HTML or JavaScript may execute in the desktop client when the affected database is opened, potentially enabling arbitrary code execution where Node integration is available.

Affected context

The issue occurs in SiYuan desktop deployments that use the Template calculation operator to process user-authored templates and later render the resulting content in a client context with Node integration enabled. Risk depends on whether an attacker can influence template content or stored calculation output and whether a user opens the affected database in the vulnerable renderer.

Exploit preconditions

  • Attack surface: Template calculation content and the desktop database renderer
  • Required access: Ability to create or modify user-authored templates, calculation content, or synchronized database data
  • Trigger point: Opening the affected database in the SiYuan desktop client
  • Why exploitation is possible: Template output is stored and rendered without adequate HTML and script sanitization, while the renderer exposes privileged Node-enabled capabilities

Why this happens

The vulnerability results from treating generated template output as trusted content and rendering it without context-appropriate sanitization or isolation. This allows attacker-controlled markup and script content to persist in stored data and execute when displayed. The issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation, with the impact amplified when a desktop renderer exposes Node integration or other privileged runtime capabilities.

Potential impact

  • Arbitrary JavaScript execution in the desktop client context
  • Execution of operating-system commands where renderer privileges permit it
  • Theft or modification of accessible local files and application data
  • Account, session, or database compromise
  • Data tampering or malicious content propagation through synchronized databases

General mitigation guidance

Mitigation generally focuses on preventing untrusted template output from becoming executable markup and reducing renderer privileges.

Common defensive patterns include:

  • Applying context-aware output encoding and sanitization before storing or rendering generated content
  • Treating template results as data rather than trusted HTML by default
  • Disabling Node integration and other unnecessary privileged browser capabilities
  • Enforcing content isolation through a strict content security policy and separate rendering contexts
  • Restricting who can author or synchronize templates and database content
  • Applying least privilege to the desktop process and accessible files
  • Separating preview or rendering functionality from sensitive application operations

How teams detect issues like this

Organizations can detect related risks through:

  • Static analysis rules for unsanitized template output assigned to HTML-rendering sinks
  • Code review checks for innerHTML-like APIs, dynamic script execution, and privileged renderer configuration
  • Tests that place harmless markup and script markers in template fields and verify they remain inert
  • Policy enforcement requiring context-aware encoding, strict content security policies, and disabled Node integration unless specifically justified
  • Monitoring database synchronization and template changes for unexpected markup or script content
  • Automated application-security and dependency review tools that flag stored XSS patterns and unsafe desktop webview settings

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-rwh7-gm74-67h6
vulncheck.comvulncheck.com/advisories/siyuan-before-remote-code-execution-via-template-calculation

Frequently asked

questions

Exploitation is not necessarily network-driven. It may become remotely practical when an attacker can submit or synchronize malicious template or database content and a victim later opens that database in the desktop client.

The attacker generally needs a way to influence user-authored templates, calculation content, or synchronized database data. The exact requirement depends on the application's sharing and synchronization controls.

Treat template output as untrusted, apply context-aware sanitization or encoding, and render it in an isolated context without Node integration or unnecessary operating-system privileges.

Combine secure-by-default rendering, strict content security policies, least-privilege desktop configuration, controlled template authorship, and automated tests that verify stored user content cannot execute as script.

Find out what's already
exploitable in your codebase.