Impact
The vulnerability allows an attacker to embed malicious script payloads in a repository-controlled .crossnote/head.html file, which the Markdown Preview Enhanced extension injects into the preview webview without sanitization. The injected code executes while the document loads, before the React application and DOMPurify are initialized, and can access the acquireVsCodeApi API. Through that API, the attacker can send arbitrary messages from the webview to the extension host, potentially enabling execution of arbitrary code with the extension’s privileges.
Affected Systems
The issue affects the shd101wyy vscode-markdown-preview-enhanced extension for Visual Studio Code. Any installation of a version prior to 0.8.30 is vulnerable. Users of version 0.8.30 or later have the fix applied.
Risk and Exploitability
The CVSS score for this flaw is 6.9, indicating moderate severity, and there is no EPSS score available. It is not listed in the CISA KEV catalog. Because the vulnerability is triggered simply by opening a Markdown preview in a malicious repository, no additional user interaction is required. An attacker only needs to host a repository with a crafted .crossnote/head.html file and entice a victim to preview a markdown file in that repository. Once the preview is rendered, the injected script runs with the extension’s context, allowing remote code execution inside the extension host.
OpenCVE Enrichment