Milkdown before 7.21.3 contains a stored cross-site scripting vulnerability in the @milkdown/preset-commonmark and @milkdown/components packages… (CVE-2026-57530)
Source GCVE Database
No CVSS score published yet
- Exploitation
Not in CISA KEV, no exploitation reported
- EPSS
- 0.3% chance of exploitation in 30 days – higher than 23% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XWhat to do
AI-suggested
Users should upgrade to Milkdown version 7.21.3 or later once available. Until then, restrict document write access to trusted users only to reduce the risk of exploitation.
Description
Milkdown versions before 7.21.3 contain a stored cross-site scripting (XSS) vulnerability in the @milkdown/preset-commonmark and @milkdown/components packages. This vulnerability allows attackers with document write access to inject arbitrary JavaScript that executes in the browser context of users who open the affected document or interact with rendered links. The issue arises because raw URL values from the remark AST are stored as href attributes without validating the URL scheme, and the DOMPurify.sanitize call fails to properly sanitize these URLs, allowing javascript: payloads to bypass filtering in link previews and anchor elements.
Impact
An attacker with the ability to write to a document can inject malicious JavaScript code that executes in the browsers of users who open the document or click on rendered links. This can lead to cross-site scripting attacks, potentially compromising user sessions, stealing sensitive information, or performing actions on behalf of the user within the affected application context.
Summary
The vulnerability in Milkdown before version 7.21.3 is a stored cross-site scripting issue affecting the @milkdown/preset-commonmark and @milkdown/components packages. It occurs because the parseMarkdown runner stores raw URL values from the remark AST as href mark attributes without validating the URL scheme. Additionally, the DOMPurify.sanitize function used in edit-view.ts does not effectively sanitize these URLs, treating them as text nodes and allowing malicious javascript: URLs to pass through unmodified. This enables attackers with write access to documents to execute arbitrary JavaScript in the browser context of users who view or interact with the document, leading to potential XSS attacks.
Weaknesses
References
- nvd.nist.gov/vuln/detail/CVE-2026-57530 (opens in a new tab)
- github.com/Milkdown/milkdown/pull/2410 (opens in a new tab)
- github.com/Milkdown/milkdown/commit/db1ae721854a0ab2f188b83cf8695702966640f1 (opens in a new tab)
- github.com/Milkdown/milkdown/releases/tag/v7.21.3 (opens in a new tab)
- npmjs.com/package/@milkdown/components (opens in a new tab)
- npmjs.com/package/@milkdown/preset-commonmark (opens in a new tab)
- vulncheck.com/advisories/milkdown-stored-xss-via-javascript-url-in-link-href (opens in a new tab)