/

CVE-2026-73041

Severity:

CRITICAL RISK

(9.0)

Stored XSS (CWE-79) in SiYuan PDF Annotation Renderer

CVE-2026-73041

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Script Execution and Potential Local Code Execution

Severity:

CRITICAL RISK

(9.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SiYuan does not sufficiently validate or escape annotation fields written through the setFileAnnotation endpoint, allowing malicious markup to persist in annotated PDF data. When a user opens the affected PDF, the markup may execute as script in the PDF renderer with full Node.js access, potentially enabling local code execution and compromise of the application environment.

Affected context

The vulnerability occurs in SiYuan's PDF annotation workflow when annotation content is accepted by the setFileAnnotation endpoint and later rendered without adequate output encoding or sanitization. It is relevant where an attacker can influence annotation fields and a user subsequently opens the affected annotated PDF in the vulnerable renderer.

Exploit preconditions

  • Attack surface: The setFileAnnotation endpoint and subsequent PDF rendering workflow
  • Required access: Ability to submit or modify annotation content, either directly or through an authorized account or exposed integration
  • Trigger point: A user opening a PDF containing the malicious annotation
  • Why exploitation is possible: Annotation data is stored without sufficient validation or escaping and is interpreted as active markup by the renderer

Why this happens

The underlying bug is a stored cross-site scripting condition caused by treating attacker-influenced annotation content as trusted display markup. The application persists data without applying an appropriate validation and output-encoding strategy for the PDF renderer's execution context. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, with the renderer's scripting capabilities increasing the consequence beyond ordinary browser-based script execution.

Potential impact

  • Malicious script may execute when a user opens an affected PDF
  • An attacker could access application or renderer resources available through Node.js
  • Local files, credentials, or other sensitive data may be exposed
  • The application runtime or user environment could be compromised
  • Additional malicious actions could be performed with the renderer's available privileges

General mitigation guidance

Mitigation generally focuses on treating annotation content as untrusted data throughout storage and rendering.

Common defensive patterns include:

  • Applying context-appropriate output encoding before content reaches the PDF renderer
  • Allowing only a narrowly defined annotation format rather than arbitrary markup
  • Sanitizing active content and rejecting dangerous elements, attributes, and protocols
  • Disabling or isolating scripting and Node.js capabilities in the PDF rendering process where they are not required
  • Separating renderer privileges from sensitive application and host resources
  • Enforcing authorization and integrity controls around annotation updates
  • Using defense-in-depth browser and runtime policies to limit script impact

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying untrusted annotation data reaching HTML, PDF, or renderer output without encoding
  • Code review checks for direct string interpolation into markup or renderer templates
  • Tests that submit active-content-like input to annotation endpoints and verify neutralized output
  • Monitoring for unexpected annotation updates, unusual renderer behavior, or access to local resources during document opening
  • Policy enforcement requiring explicit sanitization and output-encoding boundaries for user-controlled document content
  • Automated application security testing and code review tools that track tainted data into script-capable sinks

Sources

SourceLink
github.comgithub.com/siyuan-note/siyuan/security/advisories/GHSA-fqpw-c3pj-w8g9
vulncheck.comvulncheck.com/advisories/siyuan-before-remote-code-execution-via-pdf-annotations

Frequently asked

questions

It can be, if an attacker can reach the annotation update functionality and influence annotation content. Exploitation still generally requires a user or automated process to open the affected PDF.

The required access depends on how the setFileAnnotation endpoint is exposed and protected. An attacker needs whatever permissions or access path allows annotation content to be created or modified.

Treat annotation fields as untrusted, enforce a strict allowed-content model, and apply context-appropriate output encoding before rendering. Renderer scripting and Node.js capabilities should also be isolated or disabled when unnecessary.

Establish clear trust boundaries for document content, test every rendering path with adversarial input, apply least privilege to rendering components, and use code review or automated analysis to detect unencoded data reaching script-capable sinks.

Find out what's already
exploitable in your codebase.