CVE-2026-116169 in SiYuan
Summary
by MITRE • 10/25/2026
SiYuan from 2.10.0 before 3.8.7 contains a stored cross-site scripting vulnerability that allows users with edit permission to inject script by placing javascript: URLs in math block content rendered with KaTeX trust enabled. Attackers can store \href, \url, or \includegraphics payloads that mathRender assigns via innerHTML, executing script in the application origin when a reader clicks the rendered link.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 10/25/2026
The vulnerability identified in SiYuan versions prior to 3.8.7 represents a significant security flaw classified as a stored cross-site scripting (XSS) attack. This specific weakness arises from improper neutralization of user input within the application's math rendering engine, which relies on KaTeX for processing mathematical expressions and related content blocks. The core issue lies in how the application handles URLs embedded within these rendered elements when the trust setting for math rendering is enabled. In this configuration, SiYuan allows users with edit permissions to inject malicious payloads directly into their documents by utilizing specific LaTeX commands such as \href, \url, or \includegraphics. These commands are processed by the KaTeX library and subsequently assigned via innerHTML operations within the browser's Document Object Model. Because the input is not adequately sanitized before being rendered, an attacker can embed javascript: URLs that bypass standard security filters designed to prevent script execution from non-http sources.
The operational impact of this vulnerability is severe due to its stored nature. Unlike reflected XSS attacks where malicious scripts are executed only when a victim clicks on a specially crafted link provided by the attacker in real-time, stored XSS persists within the application's database or local storage. This means that once an authenticated user with edit privileges injects the malicious code into a document, every subsequent user who views that specific note will have their browser execute the injected script automatically upon rendering. The attack vector is particularly insidious because it leverages legitimate features of the editor, such as math blocks and image inclusion, to disguise the payload. When a reader clicks on the rendered link or interacts with the element containing the javascript: URL, the malicious code runs in the context of the SiYuan application origin. This allows attackers to perform actions that are restricted by same-origin policy protections, potentially leading to session hijacking, credential theft, defacement of user content, or further propagation of malware within the local network if combined with other vulnerabilities.
From a classification perspective, this vulnerability aligns closely with CWE-79, which describes Improper Neutralization of Input During Web Page Generation commonly known as Cross-site Scripting. More specifically, it falls under sub-categories related to stored XSS where user input is saved and later served back to users without proper validation. In terms of the MITRE ATT&CK framework for enterprise security, this behavior maps to techniques involving client-side code injection and potentially T1059 Command and Control scripting using JavaScript if the payload were more complex. The use of javascript: URIs in href attributes is a classic evasion technique that exploits how browsers interpret protocol handlers within anchor tags, especially when developers assume that content rendered by third-party libraries like KaTeX is inherently safe or properly escaped.
Mitigation strategies for this vulnerability must address both immediate remediation and long-term architectural improvements. The primary solution is to upgrade SiYuan to version 3.8.7 or later, where the development team has presumably implemented stricter sanitization rules for URLs within math blocks and disabled unsafe innerHTML assignments for untrusted content by default. For environments that cannot immediately patch, administrators should enforce strict access controls to ensure that only highly trusted users have edit permissions on shared documents. Additionally, implementing a Content Security Policy (CSP) with directives such as script-src 'self' can help mitigate the impact of any remaining XSS vulnerabilities by preventing the execution of inline scripts and restricting sources from which JavaScript can be loaded. Developers should also adopt safe DOM manipulation practices, preferring textContent over innerHTML when inserting user-generated content into the Document Object Model to prevent unintended code execution. Regular security audits focusing on input validation in rich text editors and third-party rendering libraries are essential to maintain a robust defense against similar injection attacks.