What happened
The AI agent chat panel renders final/saved assistant replies into innerHTML without HTML sanitisation (the streaming preview is sanitised but the final render is not). The advisory confirms a working chain in a real Electron renderer: an assistant reply containing an HTML inline event handler is auto-fired, and with Node integration enabled executes OS commands.
Why it matters
This closes the loop from prompt injection to real code execution on a user's desktop. An attacker who can inject content an AI agent reads — or who controls a model endpoint — can achieve code execution on the host, an agent-native attack path rather than a generic XSS.
Attack vector
The AI agent chat panel builds a Markdown engine without HTML sanitisation and assigns the final assistant reply to innerHTML. A party able to influence a model reply — via indirect prompt injection in material the agent reads, or a configured model endpoint returning markup — can have script run in the application window; in the desktop local-kernel mode (nodeIntegration true, no CSP) this reaches require('child_process') and executes OS commands with the user's privileges.
Affected systems
SiYuan 3.7.0 before 3.8.11 (AI agent chat panel)
Mitigation
Upgrade to SiYuan 3.8.11 or later (fix in advisory GHSA-3rvg-qxwg-f3c6). Run in remote-kernel mode where a CSP is applied, and avoid routing the agent over untrusted content or unvetted model endpoints.