Skip to content
Heist/ feed
Back to feed
Medium

Milkdown < 7.21.3 DOM XSS via innerHTML Assignment

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-57531
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 07:54 UTC · Revision 1

Source evidence

Milkdown < 7.21.3 DOM XSS via innerHTML Assignment

core-osv · Original source

Published 24 Jul 2026, 19:10 UTC

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.

osv:CVE-2026-57531
Complete source record
{
  "id": "b056cfb9d64d8e2046b3e0f82248809e8d43adcf608fcb39d17d7885d79f3d65",
  "url": "https://osv.dev/vulnerability/CVE-2026-57531",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Milkdown < 7.21.3 DOM XSS via innerHTML Assignment",
    "summary": "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.",
    "evidence": "osv:CVE-2026-57531",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-57531",
      "aliases": [
        "CVE-2026-57531"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "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"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/milkdown/milkdown",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "0f85d3bb107e843707f88e2475baeba1041adb43"
                },
                {
                  "fixed": "db1ae721854a0ab2f188b83cf8695702966640f1"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "7.21.3"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandardRange"
                  },
                  {
                    "range": [
                      {
                        "fixed": "0f85d3bb107e843707f88e2475baeba1041adb43"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v7.21.3"
                  },
                  {
                    "range": [
                      {
                        "fixed": "db1ae721854a0ab2f188b83cf8695702966640f1"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v7.21.2",
            "v7.21.1",
            "v7.21.0",
            "v7.20.0",
            "v7.19.2",
            "v7.19.1",
            "v7.19.0",
            "v7.18.0",
            "v7.17.3",
            "v7.17.2",
            "v7.17.1",
            "v7.17.0",
            "v7.16.0",
            "v7.15.5",
            "v7.15.4",
            "v7.15.3",
            "v7.15.2",
            "v7.15.1",
            "v7.15.0",
            "v7.14.0",
            "v7.13.2",
            "v7.13.1",
            "v7.13.0",
            "v7.12.1",
            "v7.12.0",
            "v7.11.1",
            "v7.11.0",
            "v7.10.5",
            "v7.10.4",
            "v7.10.3",
            "v7.10.2",
            "v7.10.1",
            "v7.10.0",
            "v7.9.1",
            "v7.9.0",
            "v7.8.0",
            "v7.7.0",
            "v7.6.4",
            "v7.6.3",
            "v7.6.2",
            "v7.6.1",
            "v7.6.0",
            "v7.5.9",
            "v7.5.8",
            "v7.5.5",
            "v7.5.0",
            "v7.4.0",
            "v7.3.6",
            "v7.3.5",
            "v7.3.4",
            "v7.3.3",
            "v7.3.2",
            "v7.3.1",
            "v7.3.0",
            "v7.2.4",
            "v7.2.3",
            "v7.2.2",
            "v7.2.1",
            "v7.2.0",
            "v7.1.2-next.3",
            "v7.1.2-next.2",
            "v7.1.2-next.1",
            "v7.1.2-next.0",
            "v7.1.1",
            "v7.1.0",
            "v7.0.1",
            "v7.0.0",
            "v7.0.0-next.6",
            "v7.0.0-next.5",
            "v7.0.0-next.4",
            "v7.0.0-next.3",
            "v7.0.0-next.2",
            "v7.0.0-next.1",
            "v7.0.0-next.0",
            "v6.5.4",
            "v6.5.3",
            "v6.5.2",
            "v6.5.0",
            "v6.4.1",
            "v6.4.0",
            "v6.3.2",
            "v6.3.1",
            "v6.3.0",
            "v6.2.0",
            "v6.1.5",
            "v6.1.4",
            "v6.1.3",
            "v6.1.2",
            "v6.1.1",
            "v6.1.0",
            "v6.0.2",
            "v6.0.1",
            "v6.0.0",
            "v6.0.0-next.1",
            "v6.0.0-next.0",
            "v5.5.0",
            "v5.4.1",
            "v5.4.0",
            "v5.3.5",
            "v5.3.4",
            "v5.3.3",
            "v5.3.2",
            "v5.3.1",
            "v5.3.0",
            "v5.2.1",
            "v5.2.0",
            "v5.1.2",
            "v5.1.1",
            "v5.1.0",
            "v5.0.1",
            "v5.0.0",
            "v4.14.2",
            "v4.14.1",
            "v4.14.0",
            "v4.13.3",
            "v4.13.2",
            "v4.13.1",
            "v4.13.0",
            "v4.12.0",
            "v4.11.2",
            "v4.11.1",
            "v4.11.0",
            "v4.10.5",
            "v4.10.4",
            "v4.10.3",
            "v4.10.2",
            "v4.10.1",
            "v4.10.0",
            "v4.9.6",
            "v4.9.5",
            "v4.9.4",
            "v4.9.3",
            "v4.8.2",
            "v4.7.1",
            "v4.7.0",
            "v4.6.9",
            "v4.6.7",
            "v4.6.6",
            "v4.6.5",
            "v4.6.4",
            "v4.6.3",
            "v4.6.2",
            "v4.6.0",
            "v4.5.3",
            "v4.5.2",
            "v4.5.1",
            "v4.5.0",
            "v4.4.0",
            "v4.2.0",
            "v4.1.2"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-57531.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:33.979937644Z",
      "provider": "osv",
      "references": [
        "https://www.npmjs.com/package/@milkdown/plugin-emoji",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/57xxx/CVE-2026-57531.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-57531",
        "https://www.vulncheck.com/advisories/milkdown-dom-xss-via-innerhtml-assignment",
        "https://github.com/Milkdown/milkdown/commit/db1ae721854a0ab2f188b83cf8695702966640f1",
        "https://github.com/Milkdown/milkdown/pull/2410",
        "https://github.com/Milkdown/milkdown/releases/tag/v7.21.3",
        "https://github.com/Milkdown/milkdown"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-79"
        ],
        "cna_assigner": "VulnCheck",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/57xxx/CVE-2026-57531.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-57531",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 500993,
  "published_at": "2026-07-24T19:10:05.984+00:00"
}