Impact
jsdiff’s parsePatch and applyPatch methods can enter an infinite loop when a patch’s filename headers contain carriage return or Unicode line separator characters, consuming unlimited memory until the node.js process terminates. The same flaw also exists in applyPatch when a string patch is parsed. An additional, less intense regular-expression denial of service (ReDOS) can trigger with large patch headers that include these characters, causing parsePatch to execute in cubic time. The vulnerability allows an attacker to cause a targeted application that uses jsdiff to crash or become unresponsive by supplying a specially crafted patch; a large payload is not required, and typical size limits do not mitigate it.
Affected Systems
The security issue exists in kpdecker’s jsdiff library in all releases prior to version 8.0.3, 5.2.2, 4.0.4, and 3.5.1. Those specific releases are vulnerable if parsePatch or applyPatch is invoked with a user-controlled patch. Updated releases (8.0.3 and later, 5.2.2 and later, 4.0.4 and later, or 3.5.1 and later) contain the fix and are not affected.
Risk and Exploitability
The CVSS score is 2.7, indicating low to moderate severity, and the EPSS score is below 1%, suggesting a very low current exploitation probability. The vulnerability is not listed in the CISA KEV catalog. The attack vector is likely to be an application that accepts user-supplied patches or filenames; by providing a patch containing forbidden line break characters, an attacker can trigger the denial of service. The impact is limited to the process hosting jsdiff, with no direct escalation of privileges or data breach evident from the CVE description.
OpenCVE Enrichment
Github GHSA