Join our Newsletter — 33% off our NHI Course

What happens when a Markdown preview reaches host-level file write?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 20217
Topic starter  

TL;DR: Crafted Markdown, workspace config, or injected HTML pushed a popular VS Code extension with about 9.5 million installs from preview execution to arbitrary file write and OS command execution, according to ProjectDiscovery. Developer tooling becomes a supply-chain control point when preview content and workspace files can reach the host without hard boundaries.

Editorial analysis by NHI Mgmt Group, based on content published by ProjectDiscovery: “Supply Chain Security Analysis of a 9.5M-Install VS Code Extension”.

By the numbers:

  • 24,008 unique secrets were exposed in MCP configuration files in 2025 alone, the protocol's first year of widespread adoption, according to the State of Secrets Sprawl 2026.

Key questions

Q: Why can a workspace configuration file lead to code execution?

A: A workspace configuration file can trigger code execution when the extension host reads settings and uses them to launch commands, load tasks, or alter runtime behaviour.

Q: What is the difference between webview XSS and host command execution?

A: Webview XSS is script execution inside the embedded page, while host command execution is privileged code running in the extension host process.

Q: How should teams govern VS Code extensions that render untrusted content?

A: Treat extension webviews as untrusted rendering surfaces and make all inbound messages pass through allowlisted message handling.

Practitioner guidance

  • Harden webview message handling Allow only explicitly named commands from the webview bridge and reject all other message shapes, argument types, and URI schemes.
  • Isolate workspace-supplied code Move any parser or config evaluator that accepts workspace content into a separate runtime that cannot reach host constructors or filesystem APIs.
  • Contain preview file writes Pin write operations to the previewed workspace file, validate extensions, and block writes to shell, hook, and SSH paths.

Bottom line: A high-install editor extension can become a supply-chain risk when preview content reaches host-level privileges through weak trust boundaries.

Glossary terms: Supply Chain Risk, Vs Code Webview, Webview Message Bridge, Workspace Configuration File

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →



   
Quote
(@mr-nhi)
Member Moderator
Joined: 6 months ago
Posts: 20707
 

Editor extensions now belong in the software supply chain threat model: a popular preview extension was able to translate untrusted content into host actions because it sat inside the same environment that holds source code and credentials. That is a governance problem, not just a product bug, because developer tooling has become part of the production trust boundary. Teams that ignore extension risk leave a blind spot between code review and build output.

A few things that frame the scale:

  • Breaches involving third parties rose to 48% of all breaches, a 60% increase on the previous year, according to Verizon's 2026 Data Breach Investigations Report.

A question worth separating out:

Q: What should teams do first when an extension can write arbitrary files?

A: First, stop the extension from writing outside a narrow, pre-approved path set and review every file-write primitive that reaches arbitrary files. Then constrain filename, extension, and destination checks, because arbitrary writes can overwrite settings, scripts, or other executable content and become a code execution route.

👉 Read our full editorial: VS Code extension flaws turn a Markdown preview into supply-chain risk



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.