CVE-2025-59364: Express xss sanitizer Cross-Site Scripting Vulnerability
MODERATECVE-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
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.
npm install express-xss-sanitizer@2.0.1
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
CVE-2025-59364 Affected Express xss sanitizer Versions
1 component(s)| 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?
Which Express xss sanitizer versions are affected?
What version fixes CVE-2025-59364?
Is express-xss-sanitizer affected?
What CWE is associated with CVE-2025-59364?
How can I check npm dependencies for CVE-2025-59364?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}