Summary
VNote versions before 4.3.0 may insert attacker-controlled YAML frontmatter into the Markdown preview DOM before sanitization is applied. Opening a malicious note could execute stored JavaScript in the local file viewer and, under permissive local-content settings, expose reachable note files to a remote destination.
VNote versions before 4.3.0 may insert attacker-controlled YAML frontmatter into the Markdown preview DOM before sanitization is applied. Opening a malicious note could execute stored JavaScript in the local file viewer and, under permissive local-content settings, expose reachable note files to a remote destination.
Affected context
The issue can occur in VNote's Markdown rendering flow when YAML frontmatter from a note is placed into a preview element through an HTML-sensitive DOM property before the intended XSS protection path runs. Risk is higher when an attacker can supply or alter a note and a user opens it in the file:// viewer with local content permitted to access remote URLs.
The issue can occur in VNote's Markdown rendering flow when YAML frontmatter from a note is placed into a preview element through an HTML-sensitive DOM property before the intended XSS protection path runs. Risk is higher when an attacker can supply or alter a note and a user opens it in the file:// viewer with local content permitted to access remote URLs.
Exploit preconditions
- Attack surface: Markdown note rendering and preview in the desktop application
- Required access: Ability to provide or modify a note that a user may open
- Trigger point: Opening the attacker-controlled note in the Markdown viewer
- Why exploitation is possible: Frontmatter is inserted as HTML before sanitization, allowing script content to reach the rendered document; permissive local-content network access may then broaden the impact
- Attack surface: Markdown note rendering and preview in the desktop application
- Required access: Ability to provide or modify a note that a user may open
- Trigger point: Opening the attacker-controlled note in the Markdown viewer
- Why exploitation is possible: Frontmatter is inserted as HTML before sanitization, allowing script content to reach the rendered document; permissive local-content network access may then broaden the impact
Why this happens
The vulnerability results from assigning untrusted Markdown frontmatter to innerHTML before the sanitization routine is applied. This creates a DOM-based injection path in which data intended to be treated as metadata can be interpreted as active markup or script by the rendering engine. The issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
The vulnerability results from assigning untrusted Markdown frontmatter to innerHTML before the sanitization routine is applied. This creates a DOM-based injection path in which data intended to be treated as metadata can be interpreted as active markup or script by the rendering engine. The issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- Arbitrary JavaScript may execute when a malicious note is opened
- Local note contents may be read if they are reachable from the viewer context
- Sensitive information could be transmitted to an external server
- Application state or rendered content could be altered
- A user could be exposed to follow-on attacks without additional interaction after opening the note
- Arbitrary JavaScript may execute when a malicious note is opened
- Local note contents may be read if they are reachable from the viewer context
- Sensitive information could be transmitted to an external server
- Application state or rendered content could be altered
- A user could be exposed to follow-on attacks without additional interaction after opening the note
General mitigation guidance
Mitigation generally focuses on ensuring that note content remains data throughout the rendering pipeline.
Common defensive patterns include:
- Prefer text-only DOM APIs or trusted templating mechanisms over direct HTML assignment
- Apply context-appropriate sanitization before any content reaches an HTML-sensitive sink
- Parse and validate frontmatter separately from rendered Markdown content
- Disable local-content access to remote URLs unless the feature is strictly required
- Restrict file and application privileges to reduce the impact of local-context script execution
- Use a restrictive content security policy and isolate untrusted previews where practical
Mitigation generally focuses on ensuring that note content remains data throughout the rendering pipeline.
Common defensive patterns include:
- Prefer text-only DOM APIs or trusted templating mechanisms over direct HTML assignment
- Apply context-appropriate sanitization before any content reaches an HTML-sensitive sink
- Parse and validate frontmatter separately from rendered Markdown content
- Disable local-content access to remote URLs unless the feature is strictly required
- Restrict file and application privileges to reduce the impact of local-context script execution
- Use a restrictive content security policy and isolate untrusted previews where practical
How teams detect issues like this
Detection approaches can include:
- Static analysis rules for
innerHTMLand comparable HTML injection sinks receiving note or frontmatter data - Code review checks that verify sanitization occurs before DOM insertion, rather than after it
- Tests containing benign marker data to confirm that metadata is rendered as text and cannot become executable markup
- Policy enforcement that limits local file access and remote URL permissions in embedded browser settings
- Automated code review or security scanning tools that identify untrusted data flows into browser DOM sinks
Detection approaches can include:
- Static analysis rules for
innerHTMLand comparable HTML injection sinks receiving note or frontmatter data - Code review checks that verify sanitization occurs before DOM insertion, rather than after it
- Tests containing benign marker data to confirm that metadata is rendered as text and cannot become executable markup
- Policy enforcement that limits local file access and remote URL permissions in embedded browser settings
- Automated code review or security scanning tools that identify untrusted data flows into browser DOM sinks

