Summary
HAX CMS up to and including version 26.0.0 contains a stored cross-site scripting (XSS) vulnerability in the /system/api/saveNode endpoint, where HTML sanitization can be bypassed using specially crafted event handler attributes.
An authenticated user with permission to edit pages can inject malicious JavaScript that is persisted in site content and later executed in the browser of anyone who views the affected page.
Affected context
The vulnerability affects HAX CMS deployments (both PHP and Node.js backends) that:
- Allow authenticated users to edit or create pages via the
/system/api/saveNodeendpoint - Rely on the built-in HTML sanitizer to strip or neutralize dangerous attributes
- Render stored page content directly into the browser without additional output encoding
It becomes relevant in multi-user environments where some authenticated users are less trusted or where their content is visible to other users or visitors.
Exploit preconditions
- Attack surface: HTTP API at
/system/api/saveNode, used for saving page or node content. - Required access: Valid authenticated account with permissions to edit or create content/pages.
- Trigger point: Viewing a page or node whose stored content contains the crafted HTML with a sanitizer-bypass event attribute.
- Why exploitation is possible: The HTML sanitizer fails to correctly recognize and neutralize event handler attributes when certain syntax tricks (such as event attributes placed without whitespace before the attribute name) are used, allowing attacker-controlled JavaScript to remain in the stored content and execute in the browser.
Why this happens
The underlying issue is incomplete HTML sanitization logic applied to user-supplied content before it is stored and later rendered.
The sanitizer attempts to strip or neutralize event handler attributes (e.g., onclick) but does not correctly handle edge cases where the attribute is introduced without expected whitespace or in a form that its parsing rules do not anticipate.
This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where attacker-controlled script can be injected into a web page because validation and sanitization routines are not robust against syntactic variations of dangerous constructs.
Potential impact
- Compromise of victim user sessions through cookie or token theft, depending on browser and application protections
- Execution of arbitrary JavaScript in the context of the affected HAX CMS origin
- Unauthorized actions performed on behalf of authenticated users (e.g., administrative actions if an admin views the malicious page)
- Defacement or manipulation of site content visible to visitors
- Pivoting into further attacks such as credential harvesting, phishing overlays, or browser-based exploitation
General mitigation guidance
Effective mitigation focuses on hardening HTML handling pipelines and reducing the trust placed in stored content:
- Prefer a default-deny, allow-list-based HTML sanitizer that only permits a minimal, well-defined set of tags and attributes and rigorously normalizes input before analysis.
- Ensure sanitization logic operates on a fully parsed DOM rather than relying on string-based or regex-like matching of event handler attributes.
- Apply context-appropriate output encoding (e.g., HTML, attribute, or JavaScript encoding) when rendering user-supplied content, even after sanitization.
- Separate highly trusted content editors from lower-trust contributors, limiting who can supply raw HTML or rich content.
- Enforce principle of least privilege for application roles so that only necessary users can edit nodes/pages that are widely viewed.
- Where feasible, restrict or disable direct HTML editing and rely on structured content formats that are rendered via templates.
How teams detect issues like this
Organizations can use several approaches to detect and monitor for this type of vulnerability:
- Static analysis and security linting to flag server-side and client-side code paths that:
- Accept HTML or rich text from users
- Bypass common sanitization libraries or implement custom sanitizers
- Directly inject user-supplied HTML into templates or DOM sinks
- Code review checklists that include:
- Verification that all rich-text fields pass through a proven sanitizer
- Confirmation that sanitization covers event handlers, URLs, and CSS, as well as syntactic edge cases
- Checks for reliance on regex-only filters for HTML safety
- Dynamic application security testing (DAST) and automated fuzzing to generate variant XSS payloads, including attributes with unusual spacing or syntax, and observe reflected or stored execution.
- Content scanning and logging to detect suspicious patterns in stored data (e.g., attributes starting with
onorjavascript:URLs), combined with alerting on anomalous script execution or CSP violation reports.

