Skip to content
Heist/ feed
Back to feed
Medium

DOMPurify XSS via Missing Rawtext Elements in SAFE_FOR_XML

Type: advisorySources: OSV

DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8, fixed in commit 2726c74, contain a cross-site scripting vulnerability that allows attackers to bypass attribute sanitization by exploiting five missing rawtext elements (noscript, xmp, noembed, noframes, iframe) in the SAFE_FOR_XML regex. Attackers can include payloads like in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-0540
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 02:20 UTC · Revision 1

Source evidence

DOMPurify XSS via Missing Rawtext Elements in SAFE_FOR_XML

core-osv · Original source

Published 3 Mar 2026, 17:26 UTC

DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8, fixed in commit 2726c74, contain a cross-site scripting vulnerability that allows attackers to bypass attribute sanitization by exploiting five missing rawtext elements (noscript, xmp, noembed, noframes, iframe) in the SAFE_FOR_XML regex. Attackers can include payloads like in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.

osv:CVE-2026-0540
Complete source record
{
  "id": "02f812daea6544c2ae4733ab10254634694eaadb07441c1703cd048559475b03",
  "url": "https://osv.dev/vulnerability/CVE-2026-0540",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DOMPurify XSS via Missing Rawtext Elements in SAFE_FOR_XML",
    "summary": "DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8, fixed in commit 2726c74, contain a cross-site scripting vulnerability that allows attackers to bypass attribute sanitization by exploiting five missing rawtext elements (noscript, xmp, noembed, noframes, iframe) in the SAFE_FOR_XML regex. Attackers can include payloads like in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.",
    "evidence": "osv:CVE-2026-0540",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-0540",
      "aliases": [
        "CVE-2026-0540",
        "GHSA-v2wj-7wpq-c8vv"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/cure53/dompurify",
              "type": "GIT",
              "events": [
                {
                  "introduced": "e1ddfc7b5e6d6599c369f826699b0204e2c691b9"
                },
                {
                  "last_affected": "ee992fc4880215757c9c09e9638bb95e1dc24533"
                },
                {
                  "introduced": "3fe78d7501103832166613bb1452985dd4674008"
                },
                {
                  "fixed": "302b51de22535cc90235472c52e3401bedd46f80"
                },
                {
                  "fixed": "5e56114cb24079ce52dbc51f76e494b77afa5153"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.5.3"
                      },
                      {
                        "last_affected": "2.5.8"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "3.1.3"
                      },
                      {
                        "last_affected": "3.3.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "302b51de22535cc90235472c52e3401bedd46f80"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "5e56114cb24079ce52dbc51f76e494b77afa5153"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "3.3.2"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.5.8",
            "3.2.3",
            "2.5.7",
            "2.5.6",
            "2.5.5",
            "2.5.4",
            "2.5.3",
            "3.1.3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-0540.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:25.500568705Z",
      "provider": "osv",
      "references": [
        "https://fluidattacks.com/advisories/daft",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/0xxx/CVE-2026-0540.json",
        "https://github.com/cure53/DOMPurify/releases/tag/3.3.2",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-0540",
        "https://www.vulncheck.com/advisories/dompurify-xss-via-missing-rawtext-elements-in-safe-for-xml",
        "https://github.com/cure53/DOMPurify/commit/302b51de22535cc90235472c52e3401bedd46f80",
        "https://github.com/cure53/DOMPurify"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-79"
        ],
        "cna_assigner": "VulnCheck",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/0xxx/CVE-2026-0540.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-0540",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 491848,
  "published_at": "2026-03-03T17:26:06.621+00:00"
}