CVE-2026-93591 in SiYuan
Summary
by MITRE • 09/18/2026
SiYuan versions before 3.8.3 contain an SQL injection vulnerability in the graph.go query2Stmt function where tag values are concatenated raw into SQL string literals without escaping single quotes. A publish-mode reader or anonymous visitor can inject SQL via inline HTML span tags in the getGraph endpoint to execute arbitrary queries on the read-write database and exfiltrate private data across notebooks.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 09/18/2026
The vulnerability identified in SiYuan versions prior to 3.8.3 represents a critical security flaw within the application's graph visualization module, specifically located in the query2Stmt function found in the graph.go source file. This component is responsible for processing requests related to the getGraph endpoint, which generates visual representations of data relationships stored within the SiYuan knowledge base. The core technical deficiency lies in how user-supplied input, particularly tag values associated with notes or documents, is handled during database query construction. Instead of utilizing parameterized queries or prepared statements that safely separate code from data, the application concatenates raw tag values directly into SQL string literals. Crucially, this process fails to escape single quotes, which are common delimiters in Structured Query Language syntax. This lack of input sanitization creates a classic injection vector where malicious actors can manipulate the structure of the intended database command by injecting their own SQL code through specially crafted inputs.
The operational impact of this vulnerability is severe due to the specific authentication context required for exploitation. The flaw allows attackers who possess publish-mode reader privileges or even anonymous visitors with access to public notebooks to execute arbitrary SQL queries against the read-write database backend. By embedding malicious payloads within inline HTML span tags, an attacker can bypass standard application logic and interact directly with the underlying data storage layer. This capability enables the exfiltration of sensitive information across different notebooks that may not be publicly accessible but are linked or referenced in ways that trigger the vulnerable graph query function. The ability to read arbitrary data means that confidential notes, personal identifiers, credentials stored within note content, and other private metadata can be extracted by an unauthorized party, leading to a significant breach of confidentiality for users relying on SiYuan for secure knowledge management.
From a classification perspective, this vulnerability aligns with CWE-89, which defines Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL Injection. The specific mechanism involves the concatenation of unsanitized user input into dynamic query strings without proper escaping or parameterization. In terms of offensive security frameworks such as MITRE ATT&CK, this exploit falls under T1059, specifically sub-techniques related to command and script interpreters that allow for database interaction, often categorized under Data from Information Repositories when the goal is data exfiltration rather than system compromise. The attack vector leverages standard web application interactions via HTTP requests targeting the getGraph endpoint, making it accessible over network interfaces without requiring local access or elevated privileges beyond basic read permissions in publish mode.
Mitigation strategies must focus on immediate remediation of the codebase and broader security hardening practices. The primary fix involves refactoring the query2Stmt function to use parameterized queries exclusively for all database interactions involving user-supplied data, thereby ensuring that input is treated strictly as data rather than executable code. Additionally, implementing strict input validation and output encoding can provide defense-in-depth layers against injection attempts. For users unable to upgrade immediately, restricting access to the getGraph endpoint or disabling graph visualization features in public-facing notebooks may reduce exposure until a patch is applied. It is also recommended to review database permissions for the application user account, ensuring it adheres to the principle of least privilege by limiting write and read scopes only to necessary tables and columns. Regular security audits and static code analysis tools configured to detect SQL injection patterns should be integrated into the development lifecycle to prevent similar vulnerabilities in future releases.