CVE-2025-59364: express-xss-sanitizer has an unbounded recursion depth
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…
Published Sep 26, 2025
Affected packages
express-xss-sanitizer
- Ecosystem
- npm
- Affected
- < 2.0.1
- Fixed in
- 2.0.1
- Check
npm ls express-xss-sanitizer
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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:
npm install express-xss-sanitizer@latestReferences
- https://github.com/AhmedAdelFahim/express-xss-sanitizer/security/advisories/GHSA-hvq2-wf92-j4f3
- https://nvd.nist.gov/vuln/detail/CVE-2025-59364
- https://github.com/AhmedAdelFahim/express-xss-sanitizer/pull/23
- https://github.com/AhmedAdelFahim/express-xss-sanitizer/commit/62d6542a2a57298da7a2e02de623454007e4f6d6
- https://dbugs.ptsecurity.com/vulnerability/PT-2025-37434
- https://gist.github.com/Spendroslav/177804eaef5acfb222a550de212a1b94
- https://github.com/AhmedAdelFahim/express-xss-sanitizer
- https://www.npmjs.com/package/express-xss-sanitizer
- https://www.tenable.com/cve/CVE-2025-59364
- https://github.com/advisories/GHSA-hvq2-wf92-j4f3
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
