Skip to main content

sanitize-html EUVDEUVD-2026-36566

| CVE-2026-44990 CRITICAL
Cross-site Scripting (XSS) (CWE-79)
2026-05-14 https://github.com/apostrophecms/apostrophe GHSA-rpr9-rxv7-x643
9.3
CVSS 3.1 · Vendor: https://github.com/apostrophecms/apostrophe
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted content with xmp-wrapped payload
  2. Delivery
    Sanitizer discards xmp tags but preserves inner HTML unescaped
  3. Exploit
    Application stores sanitized output
  4. Execution
    Victim views content page
  5. Persist
    Browser parses unescaped markup as live HTML
  6. Impact
    Injected JavaScript executes in victim context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Successful exploitation requires applications using sanitize-html with default configuration settings, specifically the default disallowedTagsMode: 'discard' mode and the default nonTextTags list that omits the xmp element. The vulnerability only manifests when the sanitized output is subsequently rendered in a browser context as trusted HTML, either through direct innerHTML assignment, server-side template rendering without additional encoding, or DOM manipulation methods like insertAdjacentHTML. User interaction (UI:R per CVSS vector) is required: a victim must view the attacker-submitted content through the application's interface to trigger JavaScript execution. No authentication is required to submit malicious content (PR:N), making this exploitable against public-facing content submission endpoints such as comment forms, profile fields, or content management interfaces. The attack works against any Node.js version capable of running sanitize-html 2.17.3, confirmed tested on Node.js v25.2.1. Limiting factors include: applications that apply additional output encoding or use frameworks with automatic XSS protection may block execution even after sanitization bypass; Content Security Policy with strict script-src directives can prevent inline script execution but may not block event handler payloads.

Impact

The CVSS 9.3 (Critical) score reflects network-based exploitation requiring no authentication or complex conditions, though user interaction (UI:R) is needed to view the malicious content. The changed scope (S:C) indicates the vulnerability crosses trust boundaries between the server-side sanitization layer and client-side JavaScript execution context. Real-world risk is elevated by several factors: publicly available proof-of-concept code exists with working exploit examples for three different payload variations (script tag, img onerror, svg/script); the vulnerability affects the default configuration that most developers rely on without customization; and the widespread use of sanitize-html as a foundational security library in Node.js content management and user-generated content applications means exploitation could achieve stored XSS at scale. However, exploitation requires the victim to view attacker-submitted content that has been sanitized and re-rendered, limiting immediate wormable spread. No EPSS score or CISA KEV listing is available, suggesting this is a newly disclosed vulnerability without confirmed widespread exploitation, though the trivial exploit complexity (AC:L) and existence of working POC code significantly lower the barrier to active exploitation. The absence of a released patch version elevates urgency for affected organizations to implement workarounds.

Exploit ScenarioDerived

An attacker submits user-generated content to a Node.js web application that uses sanitize-html with default settings, embedding malicious payloads inside xmp tags: '<xmp><img src=x onerror=alert(document.cookie)></xmp>'. The sanitizer processes this input, discards the outer xmp wrapper as a disallowed tag, but appends the inner HTML unescaped to the output string, producing '<img src=x onerror=alert(document.cookie)>'. When a victim user views the stored content through the application's frontend, the browser parses this as a live img element with an onerror event handler, executing the attacker's JavaScript with access to session cookies, localStorage, and same-origin resources. Publicly available proof-of-concept code demonstrates three working payload variations using script tags, img onerror handlers, and SVG-embedded scripts, all bypassing default sanitization.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 14, 2026

The sanitize-html npm package allows remote attackers to bypass HTML sanitization and inject executable JavaScript by wrapping malicious payloads inside disallowed <xmp> tags, achieving stored cross-site scripting (XSS) in applications using default configurations. This affects all versions through 2.17.3, with no vendor-released patch identified at time of analysis. A publicly available proof-of-concept demonstrates the bypass, which leverages the library's special handling of raw-text elements. With a 9.3 CVSS score and network-based attack vector requiring only user interaction, this represents a critical risk for Node.js applications that render sanitized user content in browsers.

RemediationAI

No vendor-released patch identified at time of analysis for sanitize-html versions <= 2.17.3. Organizations should monitor the project's GitHub repository (https://github.com/apostrophecms/sanitize-html) and advisory GHSA-rpr9-rxv7-x643 for patch release announcements. As an immediate compensating control, add 'xmp' to the nonTextTags configuration array to force complete content dropping for xmp elements, preventing the unescaped text passthrough: sanitizeHtml(input, { nonTextTags: ['script', 'style', 'textarea', 'option', 'xmp'] }). This configuration change aligns xmp handling with the library's treatment of other raw-text elements and blocks the bypass vector. Trade-off: requires code changes to every sanitize-html invocation if using a wrapper function, or modification of application-wide sanitizer configuration. Alternative mitigation: implement Content Security Policy (CSP) with strict-dynamic and nonce-based script whitelisting in the browser layer to prevent execution of injected inline scripts even if sanitization is bypassed; however, this does not prevent DOM-based XSS via event handlers like onerror, so CSP alone is insufficient. For applications unable to patch immediately, consider replacing sanitize-html with DOMPurify (isomorphic-dompurify for Node.js) or implementing server-side rendering with context-aware output encoding.

Affected VersionsENISA

sanitize-html < 2.17.4

Affected Packages

npm sanitize-html fix: 2.17.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability stems from an incomplete implementation of HTML5 raw-text element handling in sanitize-html's parser integration with htmlparser2. The library's default nonTextTags list (index.js lines 138-142) includes only script, style, textarea, and option tags for complete content dropping, but omits the xmp element. However, the ontext handler (lines 569-577) explicitly special-cases both textarea and xmp, appending their text content directly to output without HTML entity encoding. Because htmlparser2 correctly treats xmp as a raw-text element per HTML5 parsing rules, markup inside xmp is parsed as text nodes during sanitization but becomes live executable HTML when the unescaped text is reassembled in the output string. This creates a context-switching bypass where disallowed tags like script can be smuggled through sanitization wrapped in an outer xmp container that itself gets discarded while its 'text' payload survives unescaped. The vulnerability is a classic double-parsing or content-type mismatch issue rooted in CWE-79 (Improper Neutralization of Input During Web Page Generation).

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/apostrophecms/apostrophe) PRIMARY 9.3 CRITICAL
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
SUSE CRITICAL
Red Hat 8.1 HIGH

Primary rating from Vendor (https://github.com/apostrophecms/apostrophe).

CVSS VectorVendor: https://github.com/apostrophecms/apostrophe

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

DescriptionCVE.org

Summary

Under the default configuration, sanitize-html can turn attacker-controlled content inside a disallowed xmp element into live HTML or JavaScript. This is a sanitizer bypass in the default disallowedTagsMode: 'discard' path and can lead to stored XSS in applications that render sanitized output back to users.

Details

In sanitize-html@2.17.3, the default nonTextTags list includes only script, style, textarea, and option in index.js lines 138-142. That means disallowed xmp tags are not treated as "drop the entire contents" tags.

Later, in the ontext handler at index.js lines 569-577, the code special-cases textarea and xmp and appends their text content directly to the output without escaping:

js
} else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && (tag === 'textarea' || tag === 'xmp')) {
  result += text;
}

Because htmlparser2 treats xmp as a raw-text element, markup inside xmp is parsed as text on input but becomes live markup again once it is appended unescaped to the sanitized output.

This creates a default sanitizer bypass. For example, a disallowed <xmp> wrapper can be used to smuggle <script> or event-handler payloads through sanitization.

The README also appears to contradict the implementation. In the "Discarding the entire contents of a disallowed tag" section, the documented exception list names only style, script, textarea, and option, and does not mention xmp.

PoC

Tested locally against sanitize-html@2.17.3 on Node.js v25.2.1.

  1. Install the package:
bash
npm install sanitize-html
  1. Run the following script:
js
const sanitizeHtml = require('sanitize-html');

console.log(sanitizeHtml('<xmp><script>alert(1)</script></xmp>'));
console.log(sanitizeHtml('<xmp><img src=x onerror=alert(1)></xmp>'));
console.log(sanitizeHtml('<xmp><svg><script>alert(1)</script></svg></xmp>'));
  1. Observed output:
html
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg><script>alert(1)</script></svg>
  1. Render any of the returned strings in a browser context that trusts sanitize-html output, for example:
js
const dirty = '<xmp><script>alert(1)</script></xmp>';
const clean = sanitizeHtml(dirty);

If clean is inserted into the DOM or stored and later rendered as trusted HTML, the attacker-controlled script executes.

Impact

This is a cross-site scripting vulnerability in the default sanitizer behavior. Any application that uses sanitize-html defaults and then renders the returned HTML as trusted output is impacted. A remote attacker who can submit HTML content can trigger execution of arbitrary JavaScript in another user's browser when that content is viewed.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 55 npm packages depend on sanitize-html (13 direct, 42 indirect)

Ecosystem-wide dependent count for version 2.17.3.

Executive ViewAI

Why It Matters

The sanitize-html npm package (versions ≤2.17.3) contains a critical vulnerability allowing attackers to inject malicious JavaScript through HTML sanitization bypass, enabling stored XSS attacks in any application using this library to process user-generated content. This affects web applications that depend on sanitize-html for security-attackers can compromise user sessions, steal credentials, or inject malware through seemingly-safe content. Organizations using this library in production must immediately evaluate exposure and implement compensating controls.

Business Impact: Severe
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: (1) Implement strict Content Security Policy (CSP) with script-src 'self' and no inline scripts to block injected JavaScript execution; (2) Apply additional server-side output encoding (HTML entity encoding) for all user-generated content before rendering; (3) Enable browser XSS protection headers (X-XSS-Protection, X-Content-Type-Options: nosniff); (4) Implement sub-resource integrity (SRI) for any inline or dynamic script loading; (5) Deploy Web Application Firewall (WAF) rules to detect and block <xmp> tag injection patterns; (6) Consider temporary restriction of HTML input acceptance until library is patched or replaced.

Threat Intelligence Overview

EPSS Score
0.1%
Top 80% exploitable
Threat Intel
1
1 source
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
Very High

Priority Score

46
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

Vendor StatusVendor

SUSE

Severity: Critical
Product Status
openSUSE Tumbleweed Fixed
SUSE Linux Enterprise High Performance Computing 12 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected
SUSE Linux Enterprise Micro 5.3 Not-Affected

References

Advisories & patches
ADVISORY https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-rpr9-rxv7-x643 ADVISORY https://vuldb.com/vuln/370809 REF https://access.redhat.com/errata/RHSA-2026:36882 REF https://access.redhat.com/errata/RHSA-2026:36883 REF https://access.redhat.com/errata/RHSA-2026:40119 REF https://access.redhat.com/errata/RHSA-2026:40138 REF https://access.redhat.com/errata/RHSA-2026:40262 REF https://access.redhat.com/errata/RHSA-2026:41031 REF https://access.redhat.com/errata/RHSA-2026:41055 REF https://access.redhat.com/errata/RHSA-2026:41064 REF https://access.redhat.com/errata/RHSA-2026:41066 REF https://access.redhat.com/errata/RHSA-2026:42146 REF https://access.redhat.com/errata/RHSA-2026:42796 REF https://access.redhat.com/errata/RHSA-2026:43052 REF https://access.redhat.com/errata/RHSA-2026:46598 REF https://access.redhat.com/errata/RHSA-2026:46685 REF https://access.redhat.com/errata/RHSA-2026:46885 REF https://access.redhat.com/errata/RHSA-2026:46903 REF https://access.redhat.com/errata/RHSA-2026:47735 REF https://access.redhat.com/errata/RHSA-2026:47737 REF https://access.redhat.com/errata/RHSA-2026:48124 REF https://access.redhat.com/errata/RHSA-2026:51196 REF https://access.redhat.com/errata/RHSA-2026:51197 REF https://access.redhat.com/errata/RHSA-2026:51349 REF https://access.redhat.com/errata/RHSA-2026:57191 REF https://access.redhat.com/errata/RHSA-2026:57194 REF https://access.redhat.com/errata/RHSA-2026:59593 REF https://access.redhat.com/errata/RHSA-2026:60386 REF https://access.redhat.com/errata/RHSA-2026:60441 REF https://access.redhat.com/errata/RHSA-2026:63046 REF https://access.redhat.com/errata/RHSA-2026:63103 REF https://access.redhat.com/security/cve/CVE-2026-44990 REF https://bugzilla.redhat.com/show_bug.cgi?id=2488565 REF https://github.com/advisories/GHSA-rpr9-rxv7-x643 REF https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44990.json

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy