GHSA-p23f-cm6q-2qp8: Github.com/siyuan note/siyuan/kernel SiYuan MCP Asset.upload Reads Arbitrary Vulnerability

MODERATE
CVSS 5.7
CWE-22
Published
Advisory Summary

GHSA-p23f-cm6q-2qp8 is a MODERATE (CVSS 5.7) siyuan mcp asset.upload reads arbitrary vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/siyuan note/siyuan/kernel libraries in the Go ecosystem. The issue involves siyuan mcp asset.upload reads arbitrary absolute file paths (workspace boundary bypass). Remediation is available by upgrading affected packages to version 0.0.0-20260813142104-b26a4a307b8a.

GHSA-p23f-cm6q-2qp8 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-p23f-cm6q-2qp8
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/siyuan note/siyuan/kernel
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-p23f-cm6q-2qp8

To remediate this vulnerability, upgrade all affected Github.com/siyuan note/siyuan/kernel dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/siyuan-note/siyuan/kernel fixed: 0.0.0-20260813142104-b26a4a307b8a
Upgrade github.com/siyuan-note/siyuan/kernel to 0.0.0-20260813142104-b26a4a307b8a
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

How to Check if You Are Affected

To determine whether your application is affected by GHSA-p23f-cm6q-2qp8, inspect your project dependencies for Github.com/siyuan note/siyuan/kernel:

inspect dependencies for github.com/siyuan-note/siyuan/kernel

Analyze the terminal output to locate any version of Github.com/siyuan note/siyuan/kernel in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260813142104-b26a4a307b8a), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Github.com/siyuan note/siyuan/kernel, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Security Advisory — SiYuan MCP `asset.upload` Reads Arbitrary Absolute File Paths (Workspace Boundary Bypass) | Field | Value | |---|---| | **Disclosed by** | joysinleung (`joysinleung@gmail.com`) | | **Report date** | 2026-08-13 | | **Product** | SiYuan (思源笔记) — `siyuan-note/siyuan` | | **Go module** | `github.com/siyuan-note/siyuan/kernel` | | **Affected versions** | `<= 3.8.0` (latest release at report time; statically confirmed on v3.8.0) | | **Patched versions** | 3.8.1 | | **Component** | `kernel/mcp/tools/asset.go` (`assetUpload`), `kernel/model/upload.go` (`InsertLocalAssets`) | | **Relationship to prior advisory** | **Residual of CVE-2026-66012** (GHSA-cvhv-7xhj-xjp8) MCP remediation. See §Relationship. | | **EPSS (exploitation probability)** | Low. Requires the AI Agent to invoke `asset.upload` and the user to approve the (category-level) confirmation; reachable via prompt-injection of the agent. | | **KEV (CISA Known Exploited)** | No (not listed in CISA KEV at report time). | | **Default-config reachable** | **Partial** — requires the Agent/MCP surface to be configured (admin) and a user approval click; the boundary check itself is entirely absent, so any approved upload reads outside the workspace. | --- ## Summary SiYuan exposes a native MCP tool `asset` → `asset.upload`. Its `files` argument is documented as a **comma-separated list of absolute file paths**. The handler (`kernel/mcp/tools/asset.go:195`) only normalizes each entry with `filepath.Abs(...)` — it performs **no workspace boundary check** (`IsSubPath`) and **no sensitive-path check** (`IsSensitivePath`). The downstream `model.InsertLocalAssets` (`kernel/model/upload.go:97`) then `os.Open`s each path and copies its bytes into the workspace `assets/` directory. Every other AI-plane file primitive in SiYuan is workspace-constrained: - `file` / `unzip` tools resolve paths via `resolvePath` (workspace-relative, escape-proof). `asset.upload` is the **only** AI tool that accepts arbitrary absolute paths with zero boundary validation. An attacker who can steer the Agent (prompt injection) can induce it to upload sensitive files — e.g. `/Users/victim/.ssh/id_rsa`, `~/.aws/credentials`, `/etc/passwd` — into the workspace, from where they are reachable via notes / export / sync. ## Relationship to Prior Advisories - **CVE-2026-66012** (GHSA-cvhv-7xhj-xjp8) remediated the MCP endpoint by requiring `CheckAdminRole` on `/mcp` and adding `refuseToAccess` for `conf/conf.json` in the *file* tool. However, the **`asset.upload` tool was never given a workspace boundary check** — it still accepts and reads any absolute path. This is a **residual boundary omission** from that remediation: the admin gate restricts *who* may call MCP, but does not constrain *which files* `asset.upload` may read. We report it as the unpatched half of the MCP file-surface hardening. ## Affected Version Statically confirmed on the latest release **v3.8.0** (tag `v3.8.0`, commit `251596fc0`): - `kernel/mcp/tools/asset.go:195` `assetUpload`: `abs, _ := filepath.Abs(strings.TrimSpace(f))` — normalization only. - `kernel/model/upload.go:97` `InsertLocalAssets`: iterates the path list and `os.Open(assetAbsPath)` → `writeAssetFile(writePath, ...)` into `assetsDirPath`; the `IsSubPath(assetsDirPath, assetAbsPath)` check at line 130 is **only a dedup guard**, not a boundary limit. No workspace/external restriction is applied. ## Component - `kernel/mcp/tools/asset.go:195` — `assetUpload` (`files` arg → `filepath.Abs` only). - `kernel/model/upload.go:97` — `InsertLocalAssets` (`os.Open` + copy to `assets/`). - Contrast (safe): `kernel/mcp/tools/unzip.go:52` `unzipHandler` uses `resolvePath` (workspace-relative, escape-proof). ## Attack Vector **AI Agent / prompt injection.** Victim lets the Agent process attacker-controlled web/note content → agent is induced to call `asset.upload` with `/Users/victim/.ssh/id_rsa` (or similar) as a `files` entry. The user sees a **category-level** confirmation ("upload asset") that does **not** display the specific source path, so the approval is effectively blind to the actual file being read. Once approved, the file is copied into the workspace and exfiltrated via notes/export/sync. No admin role is required beyond the existing Agent/MCP configuration. ## Proof of Concept ```jsonc // Agent tool call (asset.upload), attacker-influenced files argument: { "id": "<someBlockID>", "files": "/Users/victim/.ssh/id_rsa,/Users/victim/.aws/credentials,/etc/passwd" } ``` Handler flow: 1. `filepath.Abs("/Users/victim/.ssh/id_rsa")` → `/Users/victim/.ssh/id_rsa` (no `IsSubPath`/`IsSensitivePath` rejection). 2. `InsertLocalAssets` → `os.Open` → bytes copied into `<workspace>/data/assets/...`. 3. The private key is now readable via the workspace file API / export / sync. ## Impact Confidentiality breach: arbitrary local file read (including SSH keys, cloud credentials, OS secrets) through the AI plane. Integrity/availability not directly impacted. Severity is moderated by the required user approval step, but the approval dialog does not reveal the real source path, so the user cannot make an informed decision. ## Scope Reachable only when the Agent/MCP surface is configured and the user approves the upload action. The boundary check is absent regardless of config — any approved upload reads outside the workspace. ## Remediation 1. **Add boundary enforcement in `assetUpload`**: reject any entry where `!util.IsSubPath(util.WorkspaceDir, abs)` or `util.IsSensitivePath(abs)` (same checks used elsewhere). 2. **Show the real source path in the confirmation dialog** so the user can make an informed decision (currently the `LocalWrite` gate is action-category based and hides the specific path). 3. Mirror the `resolvePath` workspace-relative constraint already applied to the `file` / `unzip` tools. > Note: patch authored against v3.8.0 source; not compiled into a full SiYuan release build. Provided for the maintainer to validate in CI. --- ## Appendix: Suggested Patch (F10) ```diff diff --git a/kernel/mcp/tools/asset.go b/kernel/mcp/tools/asset.go index aaa..bbb 100644 --- a/kernel/mcp/tools/asset.go +++ b/kernel/mcp/tools/asset.go @@ -195,8 +195,16 @@ func assetUpload(args map[string]any) (CallToolResult, error) { fileList := strings.Split(filesStr, ",") for i, f := range fileList { abs, err := filepath.Abs(strings.TrimSpace(f)) - if err != nil { + if err != nil { return CallToolResult{}, err } + // 边界校验:仅允许工作区内的资产,拒绝任意绝对路径越界读 + if !util.IsSubPath(util.WorkspaceDir, abs) || util.IsSensitivePath(abs) { + ret.Code = -1 + ret.Msg = fmt.Sprintf("asset path %s is outside the workspace or sensitive", abs) + return CallToolResult{}, fmt.Errorf("asset path outside workspace: %s", abs) + } fileList[i] = abs } succMap, err := model.InsertLocalAssets(id, fileList, true) ```

GHSA-p23f-cm6q-2qp8 Affected Github.com/siyuan note/siyuan/kernel Versions

1 component(s)
Fixed Versions:
0.0.0-20260813142104-b26a4a307b8a
Product / Package Ecosystem Affected Versions Fixed Version
github.com/siyuan-note/siyuan/kernel
Go
< 0.0.0-20260813142104-b26a4a307b8a
0.0.0-20260813142104-b26a4a307b8a

References

Frequently Asked Questions

What is GHSA-p23f-cm6q-2qp8?
GHSA-p23f-cm6q-2qp8 is a security vulnerability in Github.com/siyuan note/siyuan/kernel involving SiYuan MCP asset.upload Reads Arbitrary Absolute File Paths (Workspace Boundary Bypass) under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/siyuan note/siyuan/kernel versions are affected?
Affected versions include releases prior to 0.0.0-20260813142104-b26a4a307b8a across affected packages: github.com/siyuan-note/siyuan/kernel.
What version fixes GHSA-p23f-cm6q-2qp8?
Upgrading to 0.0.0-20260813142104-b26a4a307b8a (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/siyuan-note/siyuan/kernel affected?
Yes, github.com/siyuan-note/siyuan/kernel is affected in releases prior to 0.0.0-20260813142104-b26a4a307b8a. Upgrade your dependency to 0.0.0-20260813142104-b26a4a307b8a or later.
What is the CVSS score of GHSA-p23f-cm6q-2qp8?
GHSA-p23f-cm6q-2qp8 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-p23f-cm6q-2qp8?
GHSA-p23f-cm6q-2qp8 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Go dependencies for GHSA-p23f-cm6q-2qp8?
Run the dependency tree command: 'inspect dependencies for github.com/siyuan-note/siyuan/kernel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p23f-cm6q-2qp8",
  "modified" : "2026-10-02T23:16:56Z",
  "published" : "2026-10-02T23:16:56Z",
  "aliases" : [ ],
  "summary" : "SiYuan MCP asset.upload Reads Arbitrary Absolute File Paths (Workspace Boundary Bypass)",
  "details" : "# Security Advisory — SiYuan MCP `asset.upload` Reads Arbitrary Absolute File Paths (Workspace Boundary Bypass)\n\n| Field | Value |\n|---|---|\n| **Disclosed by** | joysinleung (`joysinleung@gmail.com`) |\n| **Report date** | 2026-08-13 |\n| **Product** | SiYuan (思源笔记) — `siyuan-note/siyuan` |\n| **Go module** | `github.com/siyuan-note/siyuan/kernel` |\n| **Affected versions** | `<= 3.8.0` (latest release at report time; statically confirmed on v3.8.0) |\n| **Patched versions** | 3.8.1 |\n| **Component** | `kernel/mcp/tools/asset.go` (`assetUpload`), `kernel/model/upload.go` (`InsertLocalAssets`) |\n| **Relationship to prior advisory** | **Residual of CVE-2026-66012** (GHSA-cvhv-7xhj-xjp8) MCP remediation. See §Relationship. |\n| **EPSS (exploitation probability)** | Low. Requires the AI Agent to invoke `asset.upload` and the user to approve the (category-level) confirmation; reachable via prompt-injection of the agent. |\n| **KEV (CISA Known Exploited)** | No (not listed in CISA KEV at report time). |\n| **Default-config reachable** | **Partial** — requires the Agent/MCP surface to be configured (admin) and a user approval click; the boundary check itself is entirely absent, so any approved upload reads outside the workspace. |\n\n---\n\n## Summary\n\nSiYuan exposes a native MCP tool `asset` → `asset.upload`. Its `files` argument is documented as a **comma-separated list of absolute file paths**. The handler (`kernel/mcp/tools/asset.go:195`) only normalizes each entry with `filepath.Abs(...)` — it performs **no workspace boundary check** (`IsSubPath`) and **no sensitive-path check** (`IsSensitivePath`). The downstream `model.InsertLocalAssets` (`kernel/model/upload.go:97`) then `os.Open`s each path and copies its bytes into the workspace `assets/` directory.\n\nEvery other AI-plane file primitive in SiYuan is workspace-constrained:\n- `file` / `unzip` tools resolve paths via `resolvePath` (workspace-relative, escape-proof).\n\n`asset.upload` is the **only** AI tool that accepts arbitrary absolute paths with zero boundary validation. An attacker who can steer the Agent (prompt injection) can induce it to upload sensitive files — e.g. `/Users/victim/.ssh/id_rsa`, `~/.aws/credentials`, `/etc/passwd` — into the workspace, from where they are reachable via notes / export / sync.\n\n## Relationship to Prior Advisories\n\n- **CVE-2026-66012** (GHSA-cvhv-7xhj-xjp8) remediated the MCP endpoint by requiring `CheckAdminRole` on `/mcp` and adding `refuseToAccess` for `conf/conf.json` in the *file* tool. However, the **`asset.upload` tool was never given a workspace boundary check** — it still accepts and reads any absolute path. This is a **residual boundary omission** from that remediation: the admin gate restricts *who* may call MCP, but does not constrain *which files* `asset.upload` may read. We report it as the unpatched half of the MCP file-surface hardening.\n\n## Affected Version\n\nStatically confirmed on the latest release **v3.8.0** (tag `v3.8.0`, commit `251596fc0`):\n- `kernel/mcp/tools/asset.go:195` `assetUpload`: `abs, _ := filepath.Abs(strings.TrimSpace(f))` — normalization only.\n- `kernel/model/upload.go:97` `InsertLocalAssets`: iterates the path list and `os.Open(assetAbsPath)` → `writeAssetFile(writePath, ...)` into `assetsDirPath`; the `IsSubPath(assetsDirPath, assetAbsPath)` check at line 130 is **only a dedup guard**, not a boundary limit. No workspace/external restriction is applied.\n\n## Component\n\n- `kernel/mcp/tools/asset.go:195` — `assetUpload` (`files` arg → `filepath.Abs` only).\n- `kernel/model/upload.go:97` — `InsertLocalAssets` (`os.Open` + copy to `assets/`).\n- Contrast (safe): `kernel/mcp/tools/unzip.go:52` `unzipHandler` uses `resolvePath` (workspace-relative, escape-proof).\n\n## Attack Vector\n\n**AI Agent / prompt injection.** Victim lets the Agent process attacker-controlled web/note content → agent is induced to call `asset.upload` with `/Users/victim/.ssh/id_rsa` (or similar) as a `files` entry. The user sees a **category-level** confirmation (\"upload asset\") that does **not** display the specific source path, so the approval is effectively blind to the actual file being read. Once approved, the file is copied into the workspace and exfiltrated via notes/export/sync. No admin role is required beyond the existing Agent/MCP configuration.\n\n## Proof of Concept\n\n```jsonc\n// Agent tool call (asset.upload), attacker-influenced files argument:\n{\n  \"id\": \"<someBlockID>\",\n  \"files\": \"/Users/victim/.ssh/id_rsa,/Users/victim/.aws/credentials,/etc/passwd\"\n}\n```\nHandler flow:\n1. `filepath.Abs(\"/Users/victim/.ssh/id_rsa\")` → `/Users/victim/.ssh/id_rsa` (no `IsSubPath`/`IsSensitivePath` rejection).\n2. `InsertLocalAssets` → `os.Open` → bytes copied into `<workspace>/data/assets/...`.\n3. The private key is now readable via the workspace file API / export / sync.\n\n## Impact\n\nConfidentiality breach: arbitrary local file read (including SSH keys, cloud credentials, OS secrets) through the AI plane. Integrity/availability not directly impacted. Severity is moderated by the required user approval step, but the approval dialog does not reveal the real source path, so the user cannot make an informed decision.\n\n## Scope\n\nReachable only when the Agent/MCP surface is configured and the user approves the upload action. The boundary check is absent regardless of config — any approved upload reads outside the workspace.\n\n## Remediation\n\n1. **Add boundary enforcement in `assetUpload`**: reject any entry where `!util.IsSubPath(util.WorkspaceDir, abs)` or `util.IsSensitivePath(abs)` (same checks used elsewhere).\n2. **Show the real source path in the confirmation dialog** so the user can make an informed decision (currently the `LocalWrite` gate is action-category based and hides the specific path).\n3. Mirror the `resolvePath` workspace-relative constraint already applied to the `file` / `unzip` tools.\n\n> Note: patch authored against v3.8.0 source; not compiled into a full SiYuan release build. Provided for the maintainer to validate in CI.\n\n---\n\n## Appendix: Suggested Patch (F10)\n\n```diff\ndiff --git a/kernel/mcp/tools/asset.go b/kernel/mcp/tools/asset.go\nindex aaa..bbb 100644\n--- a/kernel/mcp/tools/asset.go\n+++ b/kernel/mcp/tools/asset.go\n@@ -195,8 +195,16 @@ func assetUpload(args map[string]any) (CallToolResult, error) {\n \tfileList := strings.Split(filesStr, \",\")\n \tfor i, f := range fileList {\n \t\tabs, err := filepath.Abs(strings.TrimSpace(f))\n-\t\tif err != nil {\n+\t\tif err != nil {\n \t\t\treturn CallToolResult{}, err\n \t\t}\n+\t\t// 边界校验:仅允许工作区内的资产,拒绝任意绝对路径越界读\n+\t\tif !util.IsSubPath(util.WorkspaceDir, abs) || util.IsSensitivePath(abs) {\n+\t\t\tret.Code = -1\n+\t\t\tret.Msg = fmt.Sprintf(\"asset path %s is outside the workspace or sensitive\", abs)\n+\t\t\treturn CallToolResult{}, fmt.Errorf(\"asset path outside workspace: %s\", abs)\n+\t\t}\n \t\tfileList[i] = abs\n \t}\n \tsuccMap, err := model.InsertLocalAssets(id, fileList, true)\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/siyuan-note/siyuan/kernel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260813142104-b26a4a307b8a"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-p23f-cm6q-2qp8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/commit/b26a4a307b8ae5067387ea76ce1fad6b7f4bf9e7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siyuan-note/siyuan"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siyuan-note/siyuan/releases/tag/v3.8.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-02T23:16:56Z",
    "nvd_published_at" : null
  }
}