Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-11422

CVE-2026-11422: Markdown Preview Enhanced XSS Vulnerability

CVE-2026-11422 is a code injection XSS flaw in Markdown Preview Enhanced that allows attackers to execute arbitrary JavaScript via malicious WaveDrom blocks. This post covers technical details, affected versions, and mitigation.

Published:

CVE-2026-11422 Overview

CVE-2026-11422 is a code injection vulnerability [CWE-95] in the Markdown Preview Enhanced extension for Visual Studio Code. The flaw affects Markdown Preview Enhanced 0.8.x and the underlying crossnote engine version 0.9.28. Attackers can execute arbitrary JavaScript by embedding malicious content inside a wavedrom fenced code block within a crafted Markdown document. The unsanitized content is passed directly to window.eval() in the VS Code webview context. Successful exploitation lets an attacker abuse the extension's message-passing channel to invoke arbitrary file writes on the local filesystem.

Critical Impact

Opening a malicious Markdown document in a vulnerable installation triggers arbitrary JavaScript execution in the VS Code webview and enables attacker-controlled writes to the local filesystem.

Affected Products

  • Markdown Preview Enhanced (VS Code extension) 0.8.x prior to 0.8.28
  • crossnote engine version 0.9.28
  • Visual Studio Code installations using the affected extension versions

Discovery Timeline

  • 2026-06-05 - CVE-2026-11422 published to NVD
  • 2026-06-08 - Last updated in NVD database

Technical Details for CVE-2026-11422

Vulnerability Analysis

The vulnerability resides in the WaveDrom rendering pipeline of the crossnote engine, which powers the Markdown Preview Enhanced VS Code extension. WaveDrom is a JavaScript library used to render digital timing diagrams from JSON-like markup placed inside fenced code blocks. When the preview engine encounters a ```wavedrom block, it forwards the block contents to window.eval() without sanitization. Any JavaScript embedded in that block executes inside the privileged VS Code webview context.

From that context, the injected script can communicate with the extension host through the webview message-passing API. The extension exposes handlers that perform filesystem operations, so an attacker can issue crafted messages that result in arbitrary file writes on the victim's machine. This crosses the boundary from a rendering bug into local code execution and persistent compromise.

Root Cause

The root cause is improper control of generation of code [CWE-95]. The WaveDrom renderer treats user-supplied diagram source as trusted JavaScript and passes it to window.eval(). No parser, schema validator, or sandbox isolates the WaveDrom JSON from executable code paths.

Attack Vector

Exploitation requires the victim to open a malicious Markdown file in VS Code with the vulnerable extension enabled and to trigger a preview. The attack vector is local with user interaction, but the malicious file can be delivered through email attachments, Git repositories, shared documentation, or any channel that distributes .md files. Once previewed, no further interaction is required for the payload to write attacker-controlled files to disk.

javascript
// Patch reference: yarn.lock dependency bump from vulnerable 0.9.28 to fixed 0.9.29
-crossnote@^0.9.28:
-  version "0.9.28"
-  resolved "https://registry.yarnpkg.com/crossnote/-/crossnote-0.9.28.tgz#3bab68f4dfe1ca08c4280122e3dd9927943c3e0d"
-  integrity sha512-9AaTgWYWxCN5Qb8f1hlMfb9U3UE0v086E6ictZa5xNBA+z8PMUcgayXSLmBPGfZv3u1hugHSaQByMj69RuF2MQ==
+crossnote@0.9.29:
+  version "0.9.29"
+  resolved "https://registry.yarnpkg.com/crossnote/-/crossnote-0.9.29.tgz#18de19bfdcbf036df5caa709d3fe7e66ad48ff3c"
+  integrity sha512-HKTPPuisnRFk4Mip1W/tMn0ZxnXGGm9fqInIb+rUQeEqiB5udLstlf/5i7ksSdJN8qCw15DgCoJ6y5eMNil4Pw==

Source: GitHub Commit Update

Detection Methods for CVE-2026-11422

Indicators of Compromise

  • Markdown files containing ```wavedrom fenced code blocks with embedded JavaScript constructs such as function calls, property access on window, or string concatenation outside of valid WaveDrom JSON.
  • Unexpected file writes originating from the VS Code process (Code.exe, code, or code-helper) targeting paths outside the active workspace.
  • Outbound network requests from VS Code webview renderer processes immediately after opening a Markdown preview.

Detection Strategies

  • Scan repositories and shared document stores for Markdown files with wavedrom code fences and flag any that contain JavaScript keywords (eval, Function, require, process) inside the block.
  • Monitor endpoint telemetry for child processes or file-write activity spawned by Visual Studio Code shortly after preview activation.
  • Track installed extension versions and alert on hosts running Markdown Preview Enhanced versions earlier than 0.8.28 or crossnote0.9.28.

Monitoring Recommendations

  • Enable filesystem auditing on developer workstations to capture writes by editor processes to startup, autorun, and shell configuration paths.
  • Centralize VS Code extension inventory in your endpoint or asset management platform to identify vulnerable installations at scale.
  • Review code repositories for newly added or modified Markdown files containing WaveDrom blocks as part of pull request security checks.

How to Mitigate CVE-2026-11422

Immediate Actions Required

  • Upgrade Markdown Preview Enhanced to version 0.8.28 or later, which pins crossnote to 0.9.29.
  • Audit developer endpoints for the vulnerable extension version and force-update through enterprise extension management where available.
  • Treat untrusted Markdown files as executable content and avoid previewing them outside of sandboxed environments.

Patch Information

The maintainers released crossnote0.9.29 and Markdown Preview Enhanced 0.8.28 to remediate the issue. Patch details are available in the crossnote 0.9.29 commit and the vscode-markdown-preview-enhanced 0.8.28 commit. Additional context is documented in the GitHub issue discussion and the VulnCheck advisory.

Workarounds

  • Disable or uninstall Markdown Preview Enhanced until the upgrade to 0.8.28 is verified across all endpoints.
  • Avoid opening Markdown documents from untrusted sources, including unsolicited email attachments and third-party repositories.
  • Open suspect Markdown files in a plain text editor or a non-rendering viewer rather than triggering the extension preview.
bash
# Verify the installed extension version and upgrade via the VS Code CLI
code --list-extensions --show-versions | grep markdown-preview-enhanced
code --install-extension shd101wyy.markdown-preview-enhanced --force

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.