GHSA-gcm7-57gf-953c: SiYuan: Unauthenticated SQLite Data Exfiltration via Template Injection in /api/icon/getDynamicIcon
Summary
The /api/icon/getDynamicIcon endpoint is explicitly excluded from authentication in SiYuan's kernel router (router.go, "不需要鉴权" -- no auth needed). When called with type=8 and a valid block id parameter, this endpoint invokes RenderDynamicIconContentTemplate, which executes a Go template that includes the querySQL and queryBlocks functions. These functions run arbitrary SELECT statements against the SiYuan SQLite database. An unauthenticated network-adjacent attacker who knows a valid block ID can exfiltrate all user note content, tags, asset references, and block attributes from the database.
Details
Root cause -- kernel/api/router.go, line 37:
// 不需要鉴权
ginServer.Handle("GET", "/api/icon/getDynamicIcon", getDynamicIcon)
Attack chain:
1. getDynamicIcon (kernel/api/icon.go) checks type=8 and calls model.RenderDynamicIconContentTemplate(content, id) when content contains .action{.
2. RenderDynamicIconContentTemplate (kernel/model/template.go:264) parses content as a Go template. The template function map includes querySQL and queryBlocks registered via sql.SQLTemplateFuncs.
3. querySQL calls Query(stmt, 1024) (kernel/sql/block_query.go) which executes the SQL statement against the SQLite database containing all user notes.
4. The SQL result is rendered into the SVG response body and returned to the unauthenticated caller.
Constraint: The block id parameter must be a valid block ID that exists in the database. Block IDs are 22-character strings in the format YYYYMMDDHHMMSS-XXXXXXX (timestamp + 7 alphanumeric chars). Valid IDs are embedded in shared document URLs and can be leaked through any other authenticated endpoint, referrer headers, or browser history.
Tested on SiYuan v3.6.5 (Docker, network-serving mode, access auth code enabled):
GET /api/icon/getDynamicIcon?type=8&content=.action{querySQL+"SELECT+id,content+FROM+blocks+LIMIT+5"}&id=<KNOWN_BLOCK_ID>
Host: siyuan.example.com
(No Authorization header)
Response (SVG with exfiltrated data embed
Details
Original advisory: https://github.com/advisories/GHSA-gcm7-57gf-953c
Exploitation outlook
EPSS (FIRST.org) estimates each CVE’s probability of exploitation in the next 30 days — here is the CSIRTS.com read on those numbers.
- Low exploitation riskCVE-2026-540680.24% 30-day exploitation probability — currently an unlikely target, but scores change as exploit code circulates. Riskier than 15% of all scored CVEs.
Referenced CVEs
| CVE | CSIRTS overview | External |
|---|---|---|
| CVE-2026-54068 | coverage & exploitation status | NVD · CVE.org |
More from GitHub Security Advisories
- criticalGHSA-g936-7jqj-mwv8: TSDProxy: Internal proxy auth token forwarded to backend services enables management API …2026-07-10
- highGHSA-fpg8-7664-jc5q: melange: Incomplete package integrity verification allows data section substitution2026-07-10
- mediumGHSA-48rx-c7pg-q66r: Excon does not redact additional sensitive/risky headers when following redirects2026-07-10
- highGHSA-h4g2-xfmw-q2c9: Clauster: Non-loopback deployments can serve the dashboard unauthenticated when auth.enab…2026-07-10
- mediumGHSA-rqq5-2gf9-4w4q: Secure Headers: CSP directive injection via sandbox, plugin_types, and report_to when giv…2026-07-10