CVE-2026-57531

Milkdown < 7.21.3 DOM XSS via innerHTML Assignment

Published Jul 24, 2026 CVSS 4.0 · 5.1 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

Milkdown versions earlier than 7.21.3 are vulnerable to a DOM cross‑site scripting flaw in the @milkdown/plugin-emoji module. The module's parseDOM.getAttrs handler stores the raw innerHTML of pasted span elements carrying data‑type="emoji" without sanitization. When the toMarkdown runner later serializes markdown, it assigns this unsanitized innerHTML directly to a live DOM element, bypassing the DOMPurify sanitization normally applied on the toDOM path. The result is that an unauthenticated attacker can cause a victim to paste attacker‑controlled emoji‑containing content, leading to arbitrary JavaScript execution in the host application's origin.

Affected Systems

All web applications that integrate the Milkdown editor library together with the @milkdown/plugin-emoji plugin, specifically Milkdown versions before 7.21.3. Any project embedding Milkdown without updating to the patched release is at risk.

Risk and Exploitability

The CVSS score of 5.1 indicates a moderate severity, while the EPSS score of less than 1% reflects a low probability of exploitation. The vulnerability is not listed in the CISA KEV catalog. Because the flaw is client‑side and requires a victim to paste content, attackers would most likely use social engineering or malicious clipboard content to trigger the vulnerability. Clients that have not upgraded remain susceptible to payload execution whenever a user pastes emoji content.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Milkdown and the @milkdown/plugin-emoji package to version 7.21.3 or newer.
  • If a quick upgrade is not possible, remove or disable the @milkdown/plugin-emoji plugin from the editor configuration.
  • Implement client‑side sanitization on any innerHTML assignment – for example, use DOMPurify to cleanse emoji content before it is rendered, or filter pasted content to remove data‑type="emoji" spans.

Generated by OpenCVE AI on August 3, 2026 at 19:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Milkdown
Milkdown milkdown
Vendors & Products Milkdown
Milkdown milkdown
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Milkdown < 7.21.3 DOM XSS via innerHTML Assignment
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 5.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N'}

cvssV4_0

{'score': 5.1, 'vector': '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'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Jul 25, 2026, 10:30 AM
Reserved
Jun 24, 2026, 3:58 PM
Status
Deferred
Published
Jul 24, 2026, 8:18 PM
Modified
Jul 27, 2026, 8:37 PM