CVE-2026-61784: Xhtml purifier Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-j8r4-32c5-33rc
CVSS 6.1
CWE-116 CWE-79
Published
Advisory Summary

CVE-2026-61784 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Xhtml purifier libraries in the npm ecosystem. The issue involves xhtml-purifier has html attribute-injection (sanitizer bypass) that leads to xss. Remediation is available by upgrading affected packages to version 0.4.3.

CVE-2026-61784 at a Glance

CVE Identifier CVE-2026-61784
GHSA Identifier GHSA-j8r4-32c5-33rc
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Xhtml purifier
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-61784

To remediate this vulnerability, upgrade all affected Xhtml purifier dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

xhtml-purifier fixed: 0.4.3
npm install xhtml-purifier@0.4.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls xhtml-purifier

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-61784, inspect your project dependencies using npm:

npm ls xhtml-purifier

Analyze the terminal output to locate any version of Xhtml purifier in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.3), your application is affected.

Note: The npm ls xhtml-purifier command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Xhtml purifier, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

xhtml-purifier does 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 HTML-entity-encodes attribute values before serialization.

CVE-2026-61784 Affected Xhtml purifier Versions

1 component(s)
Fixed Versions:
0.4.3
Product / Package Ecosystem Affected Versions Fixed Version
xhtml-purifier
npm
< 0.4.3
0.4.3

References

Frequently Asked Questions

What is CVE-2026-61784?
CVE-2026-61784 is a security vulnerability in Xhtml purifier involving xhtml-purifier has HTML attribute-injection (sanitizer bypass) that leads to XSS under CWE-116: Improper Encoding or Escaping of Output.
Which Xhtml purifier versions are affected?
Affected versions include releases prior to 0.4.3 across affected packages: xhtml-purifier.
What version fixes CVE-2026-61784?
Upgrading to 0.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xhtml-purifier affected?
Yes, xhtml-purifier is affected in releases prior to 0.4.3. Upgrade your dependency to 0.4.3 or later.
What is the CVSS score of CVE-2026-61784?
CVE-2026-61784 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-61784?
CVE-2026-61784 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check npm dependencies for CVE-2026-61784?
Run the dependency tree command: 'npm ls xhtml-purifier'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-j8r4-32c5-33rc",
  "modified" : "2026-09-24T19:33:24Z",
  "published" : "2026-09-24T19:33:23Z",
  "aliases" : [ "CVE-2026-61784" ],
  "summary" : "xhtml-purifier has HTML attribute-injection (sanitizer bypass) that leads to XSS",
  "details" : "xhtml-purifier does 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 HTML-entity-encodes attribute values before serialization.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "xhtml-purifier"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.4.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cstigler/node-xhtml-purifier/security/advisories/GHSA-j8r4-32c5-33rc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-61784"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cstigler/node-xhtml-purifier/pull/6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cstigler/node-xhtml-purifier/commit/21d461ad23e7bc9b3073693d5b51b9b8662044d3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cstigler/node-xhtml-purifier"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cstigler/node-xhtml-purifier/releases/tag/v0.4.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-24T19:33:23Z",
    "nvd_published_at" : "2026-09-24T18:17:16Z"
  }
}