CVE-2025-59364: Express xss sanitizer Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-hvq2-wf92-j4f3
CWE-674
Published
Advisory Summary

CVE-2025-59364 is a MODERATE cross-site scripting vulnerability (CWE-674: Uncontrolled Recursion) affecting Express xss sanitizer libraries in the npm ecosystem. The issue involves express-xss-sanitizer has an unbounded recursion depth. Remediation is available by upgrading affected packages to version 2.0.1.

CVE-2025-59364 at a Glance

CVE Identifier CVE-2025-59364
GHSA Identifier GHSA-hvq2-wf92-j4f3
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Express xss sanitizer
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-59364

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.1
npm install express-xss-sanitizer@2.0.1
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-2025-59364, 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.1), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. 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

# Security Advisory: express-xss-sanitizer ## Overview A vulnerability was discovered in express-xss-sanitizer that allowed unbounded recursion depth during sanitization of nested objects. ## Affected Versions - All versions prior to 2.0.1 ## Patched Versions - 2.0.1 and later ## Description The sanitize function in lib/sanitize.js performed recursive sanitization without depth limiting, making it vulnerable to stack overflow attacks via specially crafted deeply nested JSON objects. ## Impact An attacker could cause denial-of-service by sending a request with deeply nested structures, potentially crashing the Node.js process. ## Solution Upgrade to version 2.0.1 or later: ```bash npm install express-xss-sanitizer@latest ```

CVE-2025-59364 Affected Express xss sanitizer Versions

1 component(s)
Fixed Versions:
2.0.1
Product / Package Ecosystem Affected Versions Fixed Version
express-xss-sanitizer
npm
< 2.0.1
2.0.1

References

Frequently Asked Questions

What is CVE-2025-59364?
CVE-2025-59364 is a security vulnerability in Express xss sanitizer involving express-xss-sanitizer has an unbounded recursion depth under CWE-674: Uncontrolled Recursion.
Which Express xss sanitizer versions are affected?
Affected versions include releases prior to 2.0.1 across affected packages: express-xss-sanitizer.
What version fixes CVE-2025-59364?
Upgrading to 2.0.1 (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.1. Upgrade your dependency to 2.0.1 or later.
What CWE is associated with CVE-2025-59364?
CVE-2025-59364 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check npm dependencies for CVE-2025-59364?
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-hvq2-wf92-j4f3",
  "modified" : "2025-09-26T14:38:14Z",
  "published" : "2025-09-26T14:38:13Z",
  "aliases" : [ "CVE-2025-59364" ],
  "summary" : "express-xss-sanitizer has an unbounded recursion depth",
  "details" : "# Security Advisory: express-xss-sanitizer\n\n## Overview\nA vulnerability was discovered in express-xss-sanitizer that allowed unbounded recursion depth during sanitization of nested objects.\n\n## Affected Versions\n- All versions prior to 2.0.1\n\n## Patched Versions\n- 2.0.1 and later\n\n## Description\nThe sanitize function in lib/sanitize.js performed recursive sanitization without depth limiting, making it vulnerable to stack overflow attacks via specially crafted deeply nested JSON objects.\n\n## Impact\nAn attacker could cause denial-of-service by sending a request with deeply nested structures, potentially crashing the Node.js process.\n\n## Solution\nUpgrade to version 2.0.1 or later:\n\n```bash\nnpm install express-xss-sanitizer@latest\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "express-xss-sanitizer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/security/advisories/GHSA-hvq2-wf92-j4f3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59364"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/pull/23"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer/commit/62d6542a2a57298da7a2e02de623454007e4f6d6"
  }, {
    "type" : "WEB",
    "url" : "https://dbugs.ptsecurity.com/vulnerability/PT-2025-37434"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/Spendroslav/177804eaef5acfb222a550de212a1b94"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/AhmedAdelFahim/express-xss-sanitizer"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/express-xss-sanitizer"
  }, {
    "type" : "WEB",
    "url" : "https://www.tenable.com/cve/CVE-2025-59364"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-26T14:38:13Z",
    "nvd_published_at" : null
  }
}