SiYuan: the agent chat panel renders the last reply as raw HTML
SiYuan sanitizes the streaming preview of an agent reply but not the final render, turning a model's answer into code execution.
· SiYuan · Research by president-xd
SiYuan's AI agent chat panel renders the final assistant message as unsanitized HTML, so an injected event handler can run operating-system commands in the desktop app's local-kernel mode. The maintainer scores it 7.5.
01What happened
SiYuan published advisory GHSA-3rvg-qxwg-f3c6 on November 11, 2026 for a DOM cross-site scripting flaw in its AI agent chat panel. The reporter is credited as president-xd. Versions 3.7.0 through 3.8.10 of the siyuan npm package are affected, and the advisory names v3.8.11 as the patched version.
02How it works
The chat panel builds its Markdown engine without HTML sanitization enabled, then assigns the rendered assistant output to innerHTML. A second engine instance sanitizes the streaming preview, so a user sees clean text while the reply streams and the unsanitized body replaces it when the stream ends, stops or errors. Block-level raw HTML in a reply keeps its inline event-handler attributes, and attributes supplied through kramdown attribute-list syntax survive even where sanitization is on. In desktop local-kernel mode the window runs with Node.js integration enabled and no active Content-Security-Policy, so a handler can call Node APIs.
03Who is affected
SiYuan desktop users in local-kernel mode carry the code-execution risk, per the advisory, while remote-kernel mode applies a Content-Security-Policy without unsafe-inline. Two routes reach the sink: a model reproducing attacker-influenced markup it read, which the advisory calls probabilistic, or a configured model endpoint returning the markup directly. Saved sessions re-render through the same path, so a payload fires again whenever the session is reopened.
04What to do
Treat SiYuan's agent panel as untrusted until a stable release carries the fix, because only v3.8.11 alpha builds are published and v3.8.10 remains the latest stable release. Delete saved agent sessions that could hold a payload, since reopening one runs it again, and point the panel only at model endpoints you control.
Questions people ask
- Is there a stable SiYuan release that fixes the agent chat panel flaw?
- SiYuan's advisory names v3.8.11 as the patched version, but the project's releases page shows only v3.8.11 alpha pre-releases, the most recent published on November 16, 2026. Version 3.8.10, released November 10, is still marked as the latest stable release and sits inside the affected range. Anyone waiting for a stable fix has nothing to install yet.
- Which SiYuan configuration is exposed to code execution?
- Desktop local-kernel mode is the exposed configuration, according to the advisory, because that window runs with Node.js integration enabled, context isolation disabled, web security disabled and no active Content-Security-Policy. An injected event handler can therefore call Node APIs and run operating-system commands with the user's privileges. Remote-kernel mode applies a policy without unsafe-inline.
- How would an attacker get markup into a SiYuan assistant reply?
- The advisory describes two routes into the agent's reply. Indirect prompt injection is the first: the agent reads attacker-influenced material and the model reproduces the malicious markup, a route the advisory calls probabilistic. A model endpoint the user configured, returning the markup directly, is the second and deterministic route. Saved sessions then re-execute the payload whenever they are reopened.
Sources 2 links, all fetched
- 1github.comSiYuan Advisory
- 2github.comSiYuan Releases