CVE-2026-40318 — Vulnerability in siyuan-note/siyuan/kernel
SiYuan: Publish Reader Path Traversal Delete via `removeUnusedAttributeView`
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.46%). Schedule for your next planned update.
Does your project use an affected github.com/siyuan-note/siyuan/kernel version?
Paste your go.sum to check it for CVE-2026-40318 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
The endpoint /api/av/removeUnusedAttributeView is vulnerable to a path traversal (CWE-22) that allows an attacker to delete arbitrary .json files on the server.
The issue arises because user-controlled input (id) is directly used in filesystem path construction without validation or restriction.
Access to this endpoint (e.g., via a Reader-role or publish context) is considered a precondition and not part of the vulnerability. The root cause is unsafe path handling.
Steps To Reproduce
- Ensure the target instance has the publish service enabled (or any valid access to the endpoint).
- Send the following request:
POST /api/av/removeUnusedAttributeView HTTP/1.1
Host: <target>
Content-Type: application/json
{
"id": "../../../conf/conf"
}
- Observe that the request is accepted.
- The server resolves the path outside the intended directory and deletes the target file.
Impact
An attacker can delete arbitrary .json files within the workspace directory.
This may lead to:
- Deletion of global configuration files (e.g.,
conf/conf.json) - Loss of user data and application state
- Corruption of workspace metadata
- Persistent application instability or forced recovery
This represents a server-side arbitrary file deletion primitive, which can have severe impact depending on the targeted files.
Technical Details
The vulnerable code constructs file paths as follows:
filepath.Join(util.DataDir, "storage", "av", id+".json")
Because id is not validated, attackers can inject path traversal sequences such as ../ to escape the intended directory.
Example payloads
../local→data/storage/local.json../../storage/outline→data/storage/outline.json../../../conf/conf→conf/conf.json
No validation or restriction is applied to:
- input format
- path normalization
- directory boundaries
Root Cause
- Untrusted user input (
id) is directly used in filesystem path construction - No input validation or sanitization
- No enforcement that the resolved path stays within the intended directory
Remediation
-
Validate input strictly
- Only allow valid Attribute View IDs
- Reject any input containing path traversal sequences
-
Enforce directory boundaries
base := filepath.Join(util.DataDir, "storage", "av")
absPath := filepath.Join(base, id+".json")
if !util.IsSubPath(base, absPath) {
return error
}
-
Normalize paths before use
- Ensure canonical paths cannot escape the base directory
-
Add additional logical checks
- Verify that the target object is valid and allowed to be deleted
Advisory Timeline
- First published April 10, 2026 (230 days ago).
- Last revised September 10, 2026 — 152 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get github.com/siyuan-note/siyuan/kernel@v3.6.40.0.0-20260407035653-2f416e5253f1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/siyuan-note/siyuan/kernel Go · Affected: All versions | 3.6.40.0.0-20260407035653-2f416e5253f1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-24
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.5 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H
References
Frequently Asked Questions
- What is CVE-2026-40318?
- SiYuan: Publish Reader Path Traversal Delete via `removeUnusedAttributeView`. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.5/10).
- How do I check if my project is affected by CVE-2026-40318?
- CVE-2026-40318 affects github.com/siyuan-note/siyuan/kernel. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-40318 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 31.5% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-25539CRITICAL
SiYuan has Arbitrary File Write via /api/file/copyFile leading to RCE
- CVE-2026-69083CRITICAL
SiYuan: Unauthenticated SQL execution and REGEXP injection via fullTextSearchAssetContent (publish mode): reader-reachable raw SQL (method 2) and unescaped REGEXP (method 3) on read-write asset-content DB
- CVE-2026-32938CRITICAL
SiYuan Vulnerable to Arbitrary File Read in Desktop Publish Service
- CVE-2026-68584HIGH
SiYuan: Anonymous publish-password authentication bypass via getHeadingChildrenDOM / getHeading*Transaction / getBacklinkDoc (publish mode)
- CVE-2026-66394HIGH
SiYuan: Stored and reflected XSS in SiYuan through an SVG sanitizer bypass
- CVE-2026-73608HIGH
SiYuan: getAttributeViewSearchTarget returns database row content to anonymous readers with no publish-access check, reopening the class closed one day earlier at the adjacent route
- CVE-2026-34585HIGH
SiYuan Desktop: Stored XSS in imported .sy.zip content leads to arbitrary command execution
- CVE-2026-72793HIGH
SiYuan: Non-administrator responses from /api/system/getConf omit three secrets that the configuration-export path explicitly strips, disclosing the session-cookie signing key and the OS username to anonymous readers