Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessObtain admin token (local config or login flow)
-
DeliveryCraft UNION SELECT in op/type=3 query
-
ExploitPOST to searchHistory/getHistoryItems
-
ExecutionUnescaped SQL executes on history.db
-
ImpactExfiltrate deleted document content, titles, paths
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires a valid SiYuan admin API token - the attacker must already hold admin credentials, obtain the token from the workspace config (ws/conf/conf.json), complete the login flow, or run as/within a client that has the token (e.g. a malicious plugin or the MCP history tool). The vulnerable path is reached via POST /api/history/searchHistory or /api/history/getHistoryItems: the op field is always injectable, while query is injectable only when type=3 (search-by-doc-ID), because the stringQuery escaping is deliberately skipped for that type. There is no non-default feature toggle - the behavior exists in all builds <= 3.8.6. The limiting factor is the admin-token requirement (PR:H); this is not remote-unauthenticated and does not affect integrity or availability, as the sink is read-only against history.db. |
| Impact | This is a genuine but constrained issue, best characterized as a privileged, read-only data-exfiltration flaw rather than a drive-by compromise. The supplied CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N) is internally consistent with the GHSA evidence: exploitation is network-reachable and low-complexity, but requires high privileges (PR:H) because every affected endpoint (searchHistory, getHistoryItems, the MCP history tool) is admin-token-gated per api/router.go:236-237. Impact is confidentiality-only (VC:H, VI:N/VA:N) - a read-only UNION SELECT against history.db exposing deleted document content, titles and paths - which the score of 6.9 (Medium) reflects fairly. The vuln.today Decision label is 'this_month', indicating a prioritized-but-not-emergency fix cadence, consistent with the PR:H gating. The GHSA advisory includes a detailed, author-verified PoC (run live against a source-built v3.8.6 kernel), so working exploitation technique is public; this raises likelihood for anyone who can present an admin token (including a malicious plugin). No EPSS score is provided and the CVE is not listed in CISA KEV, so there is no evidence of active in-the-wild exploitation - the realistic threat is a malicious/compromised plugin or a leaked admin token, not mass internet-facing attack. Net: a real, patch-this-month priority for SiYuan operators, but the PR:H prerequisite keeps it below critical. |
| Exploit ScenarioDerived | An attacker who already holds (or tricks a user into installing a plugin that holds) a SiYuan admin token sends a crafted POST to /api/history/getHistoryItems with type=3 and a query such as x' UNION SELECT id,type,op,title,content,path,created FROM histories_fts_case_insensitive --, which is concatenated unescaped into the SQL executed against history.db. This exfiltrates bulk document history - including previously deleted document content, titles and paths - beyond what the structured API exposes. A detailed, author-verified PoC for this exact sequence is published in the GHSA advisory. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 25, 2026
SQL injection in the SiYuan note-taking kernel's history search handlers (all builds up to and including v3.8.6) lets anyone holding a valid admin API token read the contents of history.db beyond what the history API is meant to expose, including content, titles and paths of previously deleted documents. The flaw is privileged rather than remote-unauthenticated: the actor must already possess the workspace admin token, obtain it from ws/conf/conf.json, complete the login flow, or operate inside a client that holds it, such as a malicious plugin or the MCP history tool. Impact is read-only confidentiality loss against history.db - no integrity or availability effect - and the vendor advisory ships a reproduction that was validated against a source-built v3.8.6 kernel; no confirmed active exploitation (CISA KEV) was reported and the priority label is this_month.
RemediationAI
Upgrade to SiYuan v3.8.7, the vendor-released fixed version, which escapes op and query (stringQuery applied for all types, quote-doubling) in buildSearchHistoryQueryFilter and adds CheckSingleStatement plus CheckReadonlyStatement to sql.QueryHistory and sql.SelectHistoriesRawStmt, mirroring the sql/block_query.go hardening; see the advisory at https://github.com/siyuan-note/siyuan/security/advisories/GHSA-4hjx-84f6-gr7c. Where upgrading is not immediately possible, the practical compensating controls all target the admin-token prerequisite: keep the kernel API off untrusted networks and do not expose it to the internet (trade-off: breaks remote/mobile sync clients that rely on direct API access), rotate the api.token in ws/conf/conf.json and restrict read access to that file, since anyone who can read it can exploit the sink (trade-off: invalidates existing clients and automation until they are reconfigured), and audit or remove third-party plugins and MCP history-tool integrations that hold the token, as they inherit full exploitation capability (trade-off: loss of functionality those extensions provide). Because the injection is read-only against history.db, none of these workarounds prevent a token holder from reading deleted document content once they have the credential.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
SiYuan is a Go-based personal knowledge base whose kernel exposes an HTTP API; history is stored in a separate SQLite database (history.db) with an FTS table (histories_fts_case_insensitive in the published UNION payload). The root cause is CWE-89: in kernel/model/history.go, buildSearchHistoryQueryFilter concatenates two request-controlled values into SQL string literals - the id clause from query when type==3 (search-by-doc-ID) and the op clause - and the stringQuery escaping is deliberately skipped for type 3, leaving both sinks unescaped. The resulting statement is executed by sql.QueryHistory and sql.SelectHistoriesRawStmt with no single-statement or read-only validation, unlike the block-query sinks in sql/block_query.go which were hardened with checkRawBlockQueryStmt by GHSA-67p9-hm94-xwf3. This is a sibling gap of the earlier SQLi fixes GHSA-336w-67gx-gx2h (search) and GHSA-5rwv-4j4c-f954 / GHSA-xr4h-j7cg-q8pc (graph). Reachable routes are admin-gated (api/router.go): POST /api/history/searchHistory and POST /api/history/getHistoryItems, plus the MCP history tool. Because the sink is read-only against history.db, confidentiality is the only impacted property, but the missing guard also leaves the sink unhardened against future write or stacked-statement changes.
Know when Siyuan gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
All endpoints are admin-token-gated (PR:H), reachable over the network at low complexity with no user interaction; impact is read-only data exfiltration so C:H, I:N, A:N.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
1DescriptionCVE.org
SiYuan before v3.8.7 contains an sql injection vulnerability that allows admin-token holders to read history.db by injecting unescaped op and type=3 query values. Attackers can send crafted UNION SELECT payloads to searchHistory or getHistoryItems endpoints to exfiltrate deleted document content, titles, and paths.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
SQL injection in SiYuan's fullTextSearchAssetContent endpoint lets unauthenticated attackers and holders of publish Role
Stored cross-site scripting in SiYuan personal knowledge management before 3.7.0 lets an attacker with write access to a
SQL injection in SiYuan personal knowledge management (versions <= v3.7.2) lets attackers pass arbitrary SQL statements
Stored cross-site scripting in SiYuan's attribute-view (database) cell renderer, affecting all versions prior to 3.7.0,
SQL injection in SiYuan personal knowledge-management software (all versions before v3.7.3) lets attackers inject arbitr
A SQL injection vulnerability was discovered in Siyuan 3.1.11 in /getHistoryItems. Rated critical severity (CVSS 9.8), t
A SQL injection vulnerability has been identified in Siyuan 3.1.11 via the ids array parameter in /batchGetBlockAttrs. R
A SQL injection vulnerability has been identified in Siyuan 3.1.11 via the id parameter at /getAssetContent. Rated criti
A SQL injection vulnerability has been identified in Siyuan 3.1.11 via the notebook parameter in /searchHistory. Rated c
SiYuan personal knowledge management system prior to 3.5.4 has a stored XSS vulnerability (CVSS 9.6) that allows code ex
Remote code execution in SiYuan note-taking application (before v3.6.1) allows any malicious Bazaar marketplace package
Origin-validation bypass in SiYuan Note (open-source personal knowledge management) before 3.7.0 lets any installed Chro
EUVD-2026-109431
GHSA-hf8g-c9wm-2xp9
NVD
CVE.org
EPSS
Exploit-DB