Milkdown < 7.21.3 DOM XSS via innerHTML Assignment
milkdown
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Milkdown milkdown |
| No fix yet |
Original description
Milkdown before 7.21.3 contains a DOM cross-site scripting vulnerability in the @milkdown/plugin-emoji package that allows unauthenticated attackers to execute arbitrary JavaScript in the host application's origin by causing a victim to paste attacker-controlled content. The parseDOM.getAttrs handler stores raw innerHTML of pasted span elements with data-type="emoji" without sanitization, and the toMarkdown runner subsequently assigns this unsanitized value directly to a live DOM element's innerHTML, bypassing the DOMPurify sanitization used in the toDOM path, causing payload execution on every markdown serialization cycle.
From the CVE record · VulnCheck