← Lab /Security & privacy

Windows Notepad allows arbitrary code execution via crafted Markdown links

A command injection vulnerability in Notepad's Markdown rendering lets attackers execute arbitrary commands in the victim's security context.

Security & privacy Zero Day Initiative Blog 19 Feb 2026 Disclosure Real-world evidence

Published as “CVE-2026-20841: Arbitrary Code Execution in the Windows Notepad”

Why it matters

Exploiting Notepad's Markdown rendering can lead to remote code execution, highlighting the need to apply the patch and monitor for malicious Markdown files.

Summary

The researchers analyzed Notepad.exe version 11.2508 and found that the function handling Markdown link clicks passes unfiltered link values to ShellExecuteExW, allowing malicious protocol URIs such as file:// and ms-appinstaller:// to be executed. This enables a remote attacker who convinces a user to open a crafted .md file and click a link to run arbitrary commands as the user. The vulnerability (CVE-2026-20841) was patched by Microsoft in the February 2026 release, and the authors provide detection guidance based on regexes for network traffic containing such links. Evidence consists of static code review and vendor patch notes, without telemetry or exploit testing.

What they found 2

  1. Link filtering is insufficient, allowing malicious protocol URIs to execute arbitrary files

    “The filtering performed on the link is found to be insufficient, as it allows using malicious crafted protocol URIs, such as "file://" and "ms-appinstaller://", to execute arbitrary files in the security context of victim.”

  2. Function sub_140170F60 handles clicking on links and passes them to ShellExecuteExW

    “Function sub_140170F60() handles clicking on links in Markdown files. It filters the link value, and passes it to ShellExecuteExW() call.”

Caveats 5

  • The detection guidance may generate many false positives because the patch only restricts links to local files and HTTP(S) URIs
  • The guidance may also miss attacks using other protocol handlers that are system-configured
  • Detection guidance may result in false positives due to the patch allowing local and HTTP(S) links
  • Detection guidance may result in false negatives because other exploitable protocols may exist
  • The vulnerable function uses the configured protocol handlers and may expose additional exploitable protocols depending on the system configuration

What’s new here 4

  • Identifies improper validation of Markdown links in Windows Notepad
  • Shows that file:// and ms-appinstaller:// protocols can be abused via ShellExecuteExW
  • Provides concrete detection guidance with regular expressions for network monitoring
  • Notes that the vendor patch restricts links to local files and HTTP(S) but may cause false positives/negatives

In the news