Denial of Service Vulnerability in jsdiff Package

diff Updated 22 Jan 2026

Summary

14/01/2026
LOW
Yes i
Low
2.7

GHSA-73rr-hh4g-fpgx: jsdiff has a Denial of Service vulnerability in parsePatch and applyPatch. Affects diff across 3 version ranges.

< 4.0.4 >= 5.0.0, < 5.2.2 >= 6.0.0, < 8.0.3

Fixed in 4.0.4, 5.2.2 or 8.0.3, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The jsdiff package is a widely used library in the JavaScript ecosystem, primarily designed for computing differences between text files. It provides functionalities such as parsing patches and applying them to files, making it essential for version control and collaborative coding. However, it has been found to contain vulnerabilities that can lead to denial-of-service attacks, particularly when handling user-provided input.

Vulnerability Detail

The jsdiff package has a Denial of Service (DoS) vulnerability in its parsePatch and applyPatch methods. When a patch with specific line break characters (\r, \u2028, or \u2029) is parsed, the parsePatch method can enter an infinite loop, consuming memory until the process crashes. This vulnerability can be exploited by attackers who control input to the parsePatch method, allowing them to cause a DoS without needing a large payload. Additionally, a lesser ReDOS vulnerability can occur if these characters are present in a patch's header, leading to significant delays in processing time.

How To Fix

Latest published version: 9.0.0 as of 22 Oct 2026

npm install diff@9.0.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.0.4 4.0.4
    npm install diff@4.0.4
  • >= 5.0.0, < 5.2.2 5.2.2
    npm install diff@5.2.2
  • >= 6.0.0, < 8.0.3 8.0.3
    npm install diff@8.0.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If you cannot update to the patched version, avoid parsing patches that contain the characters \r, \u2028, or \u2029. Implement input validation to sanitize user-provided patches before processing them.

Conclusion

The jsdiff package has a critical Denial of Service vulnerability that can be exploited through malicious input. It is essential to update to the latest patched version to mitigate this risk. If updating is not feasible, ensure to implement workarounds to protect your application.

See every vulnerability recorded for diff →

Share this vulnerability

FAQ

The vulnerability has a CVSS score of 2.7, indicating a low severity level.

Yes, an attacker can exploit this vulnerability remotely by providing malicious input to the parsePatch method.

Versions of jsdiff prior to 8.0.3, 5.2.2, and 4.0.4 are affected by this vulnerability.

Yes, you can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can check your application using the Vulert playground without any signup.

If immediate updates are not possible, implement input validation to prevent parsing of malicious patches containing the specified line break characters.

Related vulnerabilities

Recent vulnerabilities recorded for diff.

How To Fix

Latest published version: 9.0.0 as of 22 Oct 2026

npm install diff@9.0.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.0.4 4.0.4
    npm install diff@4.0.4
  • >= 5.0.0, < 5.2.2 5.2.2
    npm install diff@5.2.2
  • >= 6.0.0, < 8.0.3 8.0.3
    npm install diff@8.0.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback