xhtml-purifier has HTML attribute-injection (sanitizer bypass) that leads to XSS
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- Low · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
xhtml-purifier is a Node.js library to take in raw/unknown/untrusted HTML and output cleaned, purified, trusted HTML. Versions prior to 0.4.3 do not HTML-entity-encode attribute values when serializing its sanitized output. In attributeString() (XHTMLPurifier.js, around line 148) the attribute value is concatenated directly into a double-quoted attribute without encoding. As a result, an attacker-controlled value in any allowed attribute (class, style, title, alt, src, href) can include a double-quote character to break out of the attribute and inject an additional attribute, such as a JavaScript event handler (for example onmouseover or onerror). The injected handler survives sanitization and executes when the output is rendered, which is a sanitizer bypass leading to cross-site scripting. The fix in version 0.4.3 HTML-entity-encodes attribute values before serialization.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| cstigler | node-xhtml-purifier | before 0.4.3 | 0.4.3 | Patch available | CNA |
| — | xhtml-purifier (npm) | before 0.4.3 | 0.4.3 | Patch available | GHSA-j8r4-32c5-33rc |
- node-xhtml-purifier Vendorcstigler Affected before 0.4.3 Fixed in 0.4.3 Patch available CNA
- xhtml-purifier (npm) Vendor— Affected before 0.4.3 Fixed in 0.4.3 Patch available GHSA-j8r4-32c5-33rc
Remediation
- Fix · CNA node-xhtml-purifier (cstigler) Fixed in 0.4.3
- Fix · GHSA-j8r4-32c5-33rc xhtml-purifier (npm) Fixed in 0.4.3 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2026-61784
- 2026-10-03 Alias added: GHSA-j8r4-32c5-33rc
References
Other 5
- https://github.com/cstigler/node-xhtml-purifier/security/advisories/GHSA-j8r4-32c5-33rc
- https://github.com/cstigler/node-xhtml-purifier/commit/21d461ad23e7bc9b3073693d5b51b9b8662044d3
- https://github.com/cstigler/node-xhtml-purifier/pull/6
- https://github.com/cstigler/node-xhtml-purifier
- https://github.com/cstigler/node-xhtml-purifier/releases/tag/v0.4.3
Sources
- CVE-2026-61784 · CVE Program
- CVE-2026-61784 · NVD
- FIRST EPSS
- GHSA-j8r4-32c5-33rc · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences