CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-61784

CVE-2026-61784: HTML Attribute Injection and Sanitizer Bypass in node-xhtml-purifier

Alon Barad
Alon Barad
Software Engineer

Sep 25, 2026·7 min read·17 visits

Executive Summary (TL;DR)

The xhtml-purifier library does not encode double quotes in attribute values during re-serialization, allowing attackers to inject malicious HTML attributes like event handlers and execute arbitrary JavaScript.

A critical sanitizer bypass vulnerability exists in the xhtml-purifier Node.js library prior to version 0.4.3. Due to a lack of HTML entity encoding during the attribute re-serialization phase, unauthenticated remote attackers can break out of double-quoted attribute contexts to inject arbitrary script handlers, resulting in Cross-Site Scripting.

Vulnerability Overview

The Node.js library xhtml-purifier (developed by cstigler) is designed to take raw, untrusted HTML input and sanitize it into compliant, safe XHTML or HTML output. This library is commonly integrated into web applications to allow safe user-generated content, such as blog comments, forum posts, or formatted text. The library utilizes an internal parsing mechanism to analyze elements and ensure only pre-approved tags and attributes exist in the output.

However, in versions prior to 0.4.3, xhtml-purifier fails to perform appropriate encoding on attribute values during its final serialization phase. Although the parser successfully limits elements to whitelisted attributes, it does not sanitize the contents of those attributes against context-breaking characters. This allows attackers to supply custom payloads inside permitted attributes to modify the structural syntax of the output document.

The resulting vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation) and CWE-116 (Improper Encoding or Escaping of Output). Because the injection happens during serialization after the parsing and validation phases have concluded, the injected characters bypass the sanitization filters entirely. This leads to a reliable stored or reflected cross-site scripting (XSS) vulnerability depending on how the application processes and displays the output.

Root Cause Analysis

The core vulnerability lies within the re-serialization phase of xhtml-purifier, specifically inside the attributeString() function located in XHTMLPurifier.js. When the library processes HTML, it converts the raw input into an in-memory tree representation. During this tree construction, the parser identifies whitelisted attributes, such as class, style, or title, and captures their corresponding values as literal string data without validation of special formatting characters.

During the serialization stage, the library recreates the sanitized HTML markup by iterating over the attributes and reconstructing the tags. The function outputs these values by concatenating the raw attribute value straight into double-quoted structures: string += " " + name + "=\"" + value + "\"";. Since the library does not search for, escape, or entity-encode the double-quote (") character inside the value variable, any double-quote within a permitted attribute will successfully terminate the attribute scope in the output string.

Consequently, an attacker who injects a double-quote into an allowed attribute value can append arbitrary characters that will be interpreted as new attributes by a browser. Because the input parser already validated the parent attribute as safe, the injected content bypasses the tag-stripping logic. The downstream browser parser processes the unescaped double-quote, terminates the whitelisted attribute, and interprets the malicious payload as valid, active attributes on the same tag.

Code-level Analysis and Diff

The vulnerability is highlighted when analyzing the code before the patch in XHTMLPurifier.js around line 148. The original serialization loop concatenates raw values directly without filtering:

// Vulnerable Code Path in XHTMLPurifier.js
for (var name in attributes) {
    var value = attributes[name];
    // ... validation logic
    string += " " + name + "=\"" + value + "\"";
}

To resolve this issue, the developer modified the serialization logic in commit 21d461ad23e7bc9b3073693d5b51b9b8662044d3 to implement robust escaping. The following code fragment shows the introduced changes:

// Patched Code Path in XHTMLPurifier.js
var encodedValue = String(value)
    .replace(/&(?![a-zA-Z][a-zA-Z0-9]*;|#\d+;|#x[0-9a-fA-F]+;)/g, "&")
    .replace(/"/g, """)
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;");
 
string += " " + name + "=\"" + encodedValue + "\"";

This remediation ensures that any instance of a double-quote character is transformed into its corresponding safe HTML entity (&quot;). Additionally, the patch includes escaping for less-than (<) and greater-than (>) signs to prevent premature element closure. The regular expression for ampersands uses a negative lookahead to avoid re-encoding already valid, well-formed HTML entities, preserving application behavior while protecting against bypass vectors.

Exploitation Methodology

Exploitation of CVE-2026-61784 requires the target application to utilize a vulnerable version of xhtml-purifier to sanitize untrusted user input and subsequently render the output to users. The attacker must target a whitelisted HTML element and attribute to prevent the initial parser from dropping the entire node. Attributes such as class, title, or style are suitable candidates for this vector.

The attacker crafts a payload that embeds double quotes inside a single-quoted HTML tag. When processed by xhtml-purifier, the parser accepts the overall element and parses the inner content as the value of the whitelisted attribute. An example payload format is structured as follows:

<span class='test" onmouseover="javascript:alert(document.cookie)' style='color:red;'>Hover here</span>

When the serialization logic executes, the resulting HTML string emitted by the library is structured as:

<span class="test" onmouseover="javascript:alert(document.cookie)" style="color:red;">Hover here</span>

When this output is loaded by the victim's browser, the parser recognizes onmouseover as a valid event handler attribute of the span element. Once a victim interacts with the element, the javascript payload is executed in the context of the vulnerable origin. This allows the attacker to execute arbitrary script, steal session cookies, or manipulate the page structure.

Impact Assessment

The impact of CVE-2026-61784 is assessed with a CVSS v3.1 base score of 6.1 (Medium). The attack vector is Network, meaning exploitation can occur remotely without local access requirements. The attack complexity is Low, as the payload relies on basic HTML structures and requires no specialized configuration or timing. No privileges are required to exploit the flaw, but User Interaction is required for the payload to be rendered and triggered in a browser context.

The potential impact on confidentiality is Low, as the executing script can read sensitive DOM data, session tokens, or other client-side information. Similarly, the impact on integrity is Low because the injected code can execute requests or modify application state on behalf of the victim. There is no direct impact on availability.

While categorized as Medium, the impact scales significantly if the application handles privileged administrative sessions. A successful cross-site scripting attack against an administrative user could lead to complete administrative takeover of the backend platform, illustrating how client-side bypasses can act as primary entry points for more severe downstream compromises.

Remediation and Detection

The primary remediation path is upgrading the xhtml-purifier dependency to version 0.4.3 or later. This version contains the updated serialization engine that correctly entity-encodes attribute values. Organizations utilizing automated package managers should update their definitions to exclude vulnerable versions.

To detect potential exploitation attempts at the network or application layer, security teams can employ custom rules. Web Application Firewalls (WAF) can be configured to detect attribute breakout attempts within JSON or form inputs that contain HTML. For example, patterns looking for double quotes followed immediately by event handlers inside single-quoted elements can identify active payloads.

# Example detection pattern concept for WAF or input filtering
(?i)<\w+\s+[^>]*\s*=\s*['"][^'"]*["'][^>]*\s+on[a-z]+=

Organizations should also conduct automated dependency audits using tools like npm audit or static application security testing (SAST) to discover instances of the library across all active codebases. If immediate upgrading is impossible, a temporary workaround involves manually stripping or sanitizing double quotes from input strings before passing them to the purifier library.

Official Patches

cstiglerFix Commit implementing HTML attribute value escaping
cstiglerGitHub Security Advisory

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.17%
Top 95% most exploited

Affected Systems

Applications utilizing the Node.js package 'xhtml-purifier' for HTML sanitization in versions prior to 0.4.3.

Affected Versions Detail

Product
Affected Versions
Fixed Version
xhtml-purifier
cstigler
< 0.4.30.4.3
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS Score6.1 (Medium)
EPSS Score0.00168
ImpactSanitizer Bypass / Cross-Site Scripting (XSS)
Exploit StatusPoC / Functional Tests available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Cross-site Scripting

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Vulnerability Timeline

Fixing commit authored and pushed to GitHub repository by developer.
2026-06-23
Official Advisory GHSA-j8r4-32c5-33rc published on GitHub.
2026-09-24
CVE-2026-61784 assigned and published.
2026-09-24

References & Sources

  • [1]Fix Commit (GitHub)
  • [2]GitHub Security Advisory (GHSA)
  • [3]NVD Entry
  • [4]CVE Record (CVE.org)

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
1 views•9 min read
•about 2 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
3 views•9 min read
•about 3 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 4 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
4 views•9 min read
•about 5 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 6 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
3 views•10 min read