# CVE-2025-59364: express-xss-sanitizer unbounded recursion denial of service

Source: https://junglewise.ai/threats/cve-2025-59364-express-xss-sanitizer-unbounded-recursion-denial-of-service  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2025-09-26. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2025-59364 · Severity: medium · CVSS 4 · Published 2025-09-26

express-xss-sanitizer is a Node.js library used to prevent cross-site scripting (XSS) attacks by sanitizing user input. The library contains a flaw in its sanitization logic that fails to limit recursion depth when processing deeply nested objects, allowing attackers to crash the Node.js application by sending specially crafted requests with nested structures.

Technologies: [express-xss-sanitizer (npm)](https://junglewise.ai/threats/technologies/express-xss-sanitizer). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2025-59364 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2025-59364 being exploited in the wild.

**How severe is CVE-2025-59364?** Medium severity, with a CVSS score of 4, published 26 September 2025.

**Which products and versions are affected?** express-xss-sanitizer (npm) All versions prior to 2.0.1.

**Is there a fix for CVE-2025-59364?** A patch was published on 2025-09-26: Version 2.0.1 released with recursion depth limiting Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2025-59364 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2025-59364?** Check whether you run express-xss-sanitizer (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability exists in the sanitize function in lib/sanitize.js, which recursively processes nested objects without enforcing any depth limit (CWE-674: Uncontrolled Recursion). When an attacker sends a request containing deeply nested JSON objects, the recursive sanitization process consumes stack space until exhaustion, triggering a stack overflow and crashing the Node.js process. The attack requires only network access and no authentication or user interaction. Versions prior to 2.0.1 are affected; the patch introduces recursion depth limiting.

## Affected products

- npm express-xss-sanitizer All versions prior to 2.0.1

## Identifiers

- CVE-2025-59364
- GHSA-hvq2-wf92-j4f3

## Timeline

- 2025-09-26: disclosed
- 2025-09-26: patched: Version 2.0.1 released with recursion depth limiting

## References

- [https://github.com/AhmedAdelFahim/express-xss-sanitizer/security/advisories/GHSA-hvq2-wf92-j4f3](https://github.com/AhmedAdelFahim/express-xss-sanitizer/security/advisories/GHSA-hvq2-wf92-j4f3)

## Related threats

- [express-xss-sanitizer configuration bypass leads to permissive HTML sanitization](https://junglewise.ai/threats/cve-2026-33979-ahmedadelfahim-express-xss-sanitizer-permissive-sanitization)
- [express-xss-sanitizer unbounded recursion in sanitize function](https://junglewise.ai/threats/express-xss-sanitizer-unbounded-recursion-in-sanitize-function-e4c60884)
- [express-xss-sanitizer prototype pollution bypass in allowedTags](https://junglewise.ai/threats/cve-2022-21169-express-xss-sanitizer-prototype-pollution-bypass-in-allowedtags)
