Milkdown before 7.21.3 contains a DOM cross-site scripting vulnerability in the @milkdown/plugin-emoji package that allows unauthenticated attackers… (CVE-2026-57531)
Milkdown versions before 7.21.3 contain a DOM-based cross-site scripting (XSS) vulnerability in the @milkdown/plugin-emoji package. This vulnerability allows unauthenticated attackers to execute arbitrary JavaScript in the context of the host application by tricking a victim into pasting attacker-controlled content. The issue arises because the plugin's parseDOM.getAttrs handler stores raw innerHTML from pasted span elements with data-type="emoji" without sanitization. Later, the toMarkdown runner assigns this unsanitized content directly to a live DOM element's innerHTML, bypassing the DOMPurify sanitization used elsewhere, resulting in script execution during markdown serialization cycles.
AI Analysis
Technical Summary
The vulnerability in Milkdown before version 7.21.3 is a DOM-based cross-site scripting flaw in the @milkdown/plugin-emoji package. It stems from improper sanitization of pasted emoji content: the parseDOM.getAttrs handler captures raw innerHTML from pasted span elements marked as emojis without cleaning it. Subsequently, the toMarkdown runner injects this unsanitized HTML directly into the DOM, bypassing the sanitization path used in toDOM. This flaw allows unauthenticated attackers to execute arbitrary JavaScript in the victim's browser when the victim pastes malicious content, leading to potential script execution on every markdown serialization cycle.
Potential Impact
An attacker can execute arbitrary JavaScript code in the context of the host application by causing a victim to paste specially crafted content. This can lead to theft of sensitive information, session hijacking, or other malicious actions within the victim's browser session. The vulnerability affects the integrity and security of the markdown rendering process in affected Milkdown versions.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The vulnerability is fixed in Milkdown version 7.21.3 and later. Users should upgrade to version 7.21.3 or newer to remediate this issue. Until patched, avoid pasting untrusted content that could exploit this vulnerability.
Milkdown before 7.21.3 contains a DOM cross-site scripting vulnerability in the @milkdown/plugin-emoji package that allows unauthenticated attackers… (CVE-2026-57531)
Description
Milkdown versions before 7.21.3 contain a DOM-based cross-site scripting (XSS) vulnerability in the @milkdown/plugin-emoji package. This vulnerability allows unauthenticated attackers to execute arbitrary JavaScript in the context of the host application by tricking a victim into pasting attacker-controlled content. The issue arises because the plugin's parseDOM.getAttrs handler stores raw innerHTML from pasted span elements with data-type="emoji" without sanitization. Later, the toMarkdown runner assigns this unsanitized content directly to a live DOM element's innerHTML, bypassing the DOMPurify sanitization used elsewhere, resulting in script execution during markdown serialization cycles.
CVSS v4.0
Affected software
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in Milkdown before version 7.21.3 is a DOM-based cross-site scripting flaw in the @milkdown/plugin-emoji package. It stems from improper sanitization of pasted emoji content: the parseDOM.getAttrs handler captures raw innerHTML from pasted span elements marked as emojis without cleaning it. Subsequently, the toMarkdown runner injects this unsanitized HTML directly into the DOM, bypassing the sanitization path used in toDOM. This flaw allows unauthenticated attackers to execute arbitrary JavaScript in the victim's browser when the victim pastes malicious content, leading to potential script execution on every markdown serialization cycle.
Potential Impact
An attacker can execute arbitrary JavaScript code in the context of the host application by causing a victim to paste specially crafted content. This can lead to theft of sensitive information, session hijacking, or other malicious actions within the victim's browser session. The vulnerability affects the integrity and security of the markdown rendering process in affected Milkdown versions.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The vulnerability is fixed in Milkdown version 7.21.3 and later. Users should upgrade to version 7.21.3 or newer to remediate this issue. Until patched, avoid pasting untrusted content that could exploit this vulnerability.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-7jff-jg2j-4x95
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-57531"]
- Ecosystems
- []
- Database Specific Severity
- MODERATE
- Cvss Version
- 4.0
Threat ID: 6a65422a9c2644c7f808a199
Added to database: 07/25/2026, 23:09:30 UTC
Last enriched: 07/25/2026, 23:54:47 UTC
Last updated: 07/26/2026, 04:00:58 UTC
Views: 6
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.