Vulnerabilities in pkg:npm/express-xss-sanitizer

PACKAGE
Advisory Identifier: GHSA-3843-rr4g-m8jq
Advisory Summary

CVE-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.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/express-xss-sanitizer

4 Known Advisory Record(s)

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

CVE Identifier CVE-2026-33979
GHSA Identifier GHSA-3843-rr4g-m8jq
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-183: Permissive List of Allowed Inputs
Affected Product Express XSS Sanitizer
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (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.

express-xss-sanitizer fixed: 2.0.2
npm install express-xss-sanitizer@2.0.2
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 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

## Description A vulnerability has been identified in express-xss-sanitizer (<= 2.0.1) where restrictive sanitization configurations are silently ignored. When a developer explicitly sets: allowedTags: [] allowedAttributes: {} the library incorrectly treats these values as "not provided" due to length/emptiness checks, and falls back to sanitize-html's default configuration. As 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>)```. This 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. ## Impact Developers intending to fully strip HTML content by providing empty allowedTags or allowedAttributes configurations may unknowingly allow a wide range of HTML elements and attributes. This can result in: - Injection of unintended HTML content ```(e.g., <div>, <table>, headings)``` - Injection of links via``` <a href="...">``` - Potential XSS vectors depending on downstream usage The impact depends on how the sanitized output is rendered or consumed, but the root issue is a mismatch between developer intent and actual behavior. ## Proof of Concept ```javascript const { sanitize } = require('express-xss-sanitizer'); const sanitizeHtml = require('sanitize-html'); const input = '<a href="http://evil.com">click</a><p>phish</p>'; // Using express-xss-sanitizer (v2.0.1) sanitize(input, { allowedTags: [], allowedAttributes: {} }); // => '<a href="http://evil.com">click</a><p>phish</p>' // Expected behavior (sanitize-html directly) sanitizeHtml(input, { allowedTags: [], allowedAttributes: {} }); // => 'clickphish' ``` ## Root Cause The issue was caused by validation logic that checked for non-empty arrays/objects: - allowedTags required length > 0 - allowedAttributes required Object.keys(...).length > 0 This caused empty configurations ([]) and ({}) to be ignored, resulting in fallback to default permissive settings. ## Fix The validation logic has been updated to respect explicitly provided empty configurations. Now, if allowedTags or allowedAttributes are provided (even if empty), they are passed directly to sanitize-html without being overridden.

CVE-2026-33979 Affected Express XSS Sanitizer Versions

1 component(s)
Fixed Versions:
2.0.2
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?
CVE-2026-33979 is a security vulnerability in Express XSS Sanitizer involving allowedTags/allowedAttributes bypass leads to permissive sanitization (XSS risk) under CWE-183: Permissive List of Allowed Inputs.
Which Express XSS Sanitizer versions are affected?
Affected versions include releases prior to 2.0.2 across affected packages: express-xss-sanitizer.
What version fixes CVE-2026-33979?
Upgrading to 2.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is express-xss-sanitizer affected?
Yes, express-xss-sanitizer is affected in releases prior to 2.0.2. Upgrade your dependency to 2.0.2 or later.
What is the CVSS score of CVE-2026-33979?
CVE-2026-33979 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N.
What CWE is associated with CVE-2026-33979?
CVE-2026-33979 is classified under CWE-183: Permissive List of Allowed Inputs (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.).
How can I check npm dependencies for CVE-2026-33979?
Run the dependency tree command: 'npm ls express-xss-sanitizer'. 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-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"
  }
}