Vulnerabilities in pkg:npm/express-xss-sanitizer
PACKAGECVE-2026-33979 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-183: Permissive List of Allowed Inputs) affecting Express XSS Sanitizer libraries in the npm ecosystem. The issue involves allowedtags/allowedattributes bypass leads to permissive sanitization (xss risk). Remediation is available by upgrading affected packages to version 2.0.2.
pkg:npm/express-xss-sanitizer
Vulnerability advisories affecting package pkg:npm/express-xss-sanitizer. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-3843-rr4g-m8jq | CVE-2026-33979 | HIGH | Express XSS Sanitizer: allowedTags/allowedAttributes bypass leads to permissive sanitization (XSS risk) |
| GHSA-hvq2-wf92-j4f3 | CVE-2025-59364 | MODERATE | express-xss-sanitizer has an unbounded recursion depth |
| GHSA-qhwp-454g-2gv4 | - | MODERATE | Duplicate Advisory: express-xss-sanitizer has an unbounded recursion depth |
| GHSA-grjp-4jmr-mjcw | CVE-2022-21169 | MODERATE | express-xss-sanitizer vulnerable to Prototype Pollution via allowedTags attribute |
CVE-2026-33979 at a Glance
Security Impact
CVSS: 8.2
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:N/S:U/C:L/I:H/A:N).
How to Fix CVE-2026-33979
To remediate this vulnerability, upgrade all affected Express XSS Sanitizer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install express-xss-sanitizer@2.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls express-xss-sanitizer
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-33979, inspect your project dependencies using npm:
npm ls express-xss-sanitizer
Analyze the terminal output to locate any version of Express XSS Sanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.2), your application is affected.
Note: The npm ls express-xss-sanitizer 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-183: Permissive List of Allowed Inputs, where the product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are explicitly allowed by policy because the inputs are assumed to be safe, but the list is too permissive - that is, it allows an input that is unsafe, leading to resultant weaknesses. In Express XSS Sanitizer, 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
CVE-2026-33979 Affected Express XSS Sanitizer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
express-xss-sanitizer
|
npm |
< 2.0.2
|
2.0.2
|
References
Frequently Asked Questions
What is CVE-2026-33979?
Which Express XSS Sanitizer versions are affected?
What version fixes CVE-2026-33979?
Is express-xss-sanitizer affected?
What is the CVSS score of CVE-2026-33979?
What CWE is associated with CVE-2026-33979?
How can I check npm dependencies for CVE-2026-33979?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3843-rr4g-m8jq",
"modified" : "2026-03-30T20:11:03Z",
"published" : "2026-03-27T17:56:45Z",
"aliases" : [ "CVE-2026-33979" ],
"summary" : "Express XSS Sanitizer: allowedTags/allowedAttributes bypass leads to permissive sanitization (XSS risk)",
"details" : "## Description\nA vulnerability has been identified in express-xss-sanitizer (<= 2.0.1) where restrictive sanitization configurations are silently ignored.\n\nWhen a developer explicitly sets:\n\n allowedTags: []\n allowedAttributes: {}\n\nthe library incorrectly treats these values as \"not provided\" due to length/emptiness checks, and falls back to sanitize-html's default configuration.\n\nAs a result, instead of stripping all HTML tags and attributes, the sanitizer allows a permissive set of tags ``` (e.g., <a>, <p>, <div>, etc.) and attributes (e.g., href on <a>)```.\n\nThis behavior violates the expected API contract and may lead to security issues such as content injection or XSS, depending on how the sanitized output is used.\n\n## Impact\n\nDevelopers intending to fully strip HTML content by providing empty allowedTags or allowedAttributes configurations may unknowingly allow a wide range of HTML elements and attributes.\n\nThis can result in:\n- Injection of unintended HTML content ```(e.g., <div>, <table>, headings)```\n- Injection of links via``` <a href=\"...\">```\n- Potential XSS vectors depending on downstream usage\n\nThe impact depends on how the sanitized output is rendered or consumed, but the root issue is a mismatch between developer intent and actual behavior.\n\n## Proof of Concept\n\n```javascript\nconst { sanitize } = require('express-xss-sanitizer');\nconst sanitizeHtml = require('sanitize-html');\n\nconst input = '<a href=\"http://evil.com\">click</a><p>phish</p>';\n\n// Using express-xss-sanitizer (v2.0.1)\nsanitize(input, { allowedTags: [], allowedAttributes: {} });\n// => '<a href=\"http://evil.com\">click</a><p>phish</p>'\n\n// Expected behavior (sanitize-html directly)\nsanitizeHtml(input, { allowedTags: [], allowedAttributes: {} });\n// => 'clickphish'\n```\n\n## Root Cause\nThe issue was caused by validation logic that checked for non-empty arrays/objects:\n\n- allowedTags required length > 0\n- allowedAttributes required Object.keys(...).length > 0\n\nThis caused empty configurations ([]) and ({}) to be ignored, resulting in fallback to default permissive settings.\n\n## Fix\nThe validation logic has been updated to respect explicitly provided empty configurations.\n\nNow, if allowedTags or allowedAttributes are provided (even if empty), they are passed directly to sanitize-html without being overridden.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "express-xss-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/security/advisories/GHSA-3843-rr4g-m8jq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33979"
}, {
"type" : "WEB",
"url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/commit/5623009ef11dcf095c163a38dea07b9cc22ad19f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer"
}, {
"type" : "WEB",
"url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/releases/tag/v2.0.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-183", "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-27T17:56:45Z",
"nvd_published_at" : "2026-03-27T22:16:22Z"
}
}