CVE-2026-0540

DOMPurify XSS via Missing Rawtext Elements in SAFE_FOR_XML

Published Mar 3, 2026 CVSS 4.0 · 5.3 Medium EPSS < 1% KEV · Not listed
Description
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 </noscript><img src=x onerror=alert(1)> in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.

Analysis

AI-generated

Technical impact

A flaw in DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8 allows an attacker to insert JavaScript into attribute values that bypass normal sanitization. By crafting payloads such as </noscript><img src=x onerror=alert(1)>, the attacker can cause code execution when the output is later placed inside rawtext elements – noscript, xmp, noembed, noframes, or iframe – where attribute sanitization is not enforced.

Affected Systems

This vulnerability affects the DOMPurify library distributed by cure53. Affected versions include 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8. Any web application that integrates these releases and outputs sanitized HTML into rawtext contexts is potentially impacted.

Risk and Exploitability

The CVSS score of 5.3 indicates moderate severity. EPSS is below 1 % and the issue is not listed in the CISA KEV catalog, suggesting limited exploitation activity to date. The likely attack vector involves an attacker providing malicious input to a web application that uses DOMPurify to sanitize that input before rendering it inside rawtext elements. Successful exploitation would enable the attacker to run JavaScript in the victim’s browser session, compromising confidentiality, integrity, or other aspects of the application or user data.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade DOMPurify to version 3.3.2 or later, which includes a fix for the rawtext element bypass.
  • If an upgrade is not immediately possible, remove or escape usage of the five rawtext elements (noscript, xmp, noembed, noframes, iframe) in the output rendering logic to prevent the bypass from occurring.
  • Implement a Content Security Policy that restricts script execution from user‑supplied content, adding an additional safeguard against accidental XSS.

Generated by OpenCVE AI on April 16, 2026 at 14:02 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-v2wj-7wpq-c8vv DOMPurify contains a Cross-site Scripting vulnerability
History
Type Values Removed Values Added
Metrics cvssV4_0

{'score': 5.1, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N'}

cvssV4_0

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

Type Values Removed Values Added
Description DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8, fixed in commit 729097f, 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 </noscript><img src=x onerror=alert(1)> in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts. 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 </noscript><img src=x onerror=alert(1)> in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.
References
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 DOMPurify 3.1.3 through 3.3.1 and 2.5.3 through 2.5.8, fixed in commit 729097f, 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 </noscript><img src=x onerror=alert(1)> in attribute values to execute JavaScript when sanitized output is placed inside these unprotected rawtext contexts.
Title DOMPurify XSS via Missing Rawtext Elements in SAFE_FOR_XML
First Time appeared Cure53
Cure53 dompurify
Weaknesses CWE-79
CPEs cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*
Vendors & Products Cure53
Cure53 dompurify
References
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/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:N/UI:A/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
Mar 25, 2026, 3:52 PM
Reserved
Dec 27, 2025, 1:44 AM
Status
Modified
Published
Mar 3, 2026, 6:16 PM
Modified
Jun 17, 2026, 10:10 AM
Severity
Moderate
Public date
Mar 3, 2026, 5:26 PM