CVE-2025-29907: jsPDF Bypass Regular Expression Denial of Service (ReDoS)

Published Mar 18, 2025
·
Updated

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)

Other sources

jsPDF is a library to generate PDFs in JavaScript. Prior to 3.0.1, user control of the first argument of the addImage method results in CPU utilization and denial of service. If given the possibility to pass unsanitised 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 and addSvgAsImage. The vulnerability was fixed in jsPDF 3.0.1.

MITRE

Affected Software

3 affected componentsFixes available
jsPDF jsPDF<3.0.1
npm/jspdf<3.0.1
3.0.1
parall jspdf Node.js<3.0.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/jspdf to a version that resolves this vulnerability.

    Fixed in 3.0.1
  2. Upgrade

    Upgrade jspdf to a version that resolves this vulnerability.

    Fixed in 3.0.1
  3. Configuration

    Sanitize image URLs before passing it to doc.addImage or one of the other affected methods (html and addSvgAsImage) to prevent attacker-supplied data URLs from causing high CPU utilization and denial of service.

    jsPDF (addImage/html/addSvgAsImage) sanitize image URLs before calling addImage/html/addSvgAsImage = Sanitize/validate any user-controlled image URL or data URL before passing it as the first argument to doc.addImage (and other affected methods html and addSvgAsImage).

Event History

Mar 18, 2025
CVE Published
via MITRE·06:40 PM
Data Sourced
via MITRE·06:40 PM
DescriptionWeakness
Data Sourced
via NVD·07:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:15 PM
RemedyAffected Software
Advisory Published
via GitHub·09:07 PM
Data Sourced
via GitHub·09:07 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-29907?

CVE-2025-29907 is classified as a denial of service vulnerability due to excessive CPU utilization.

2

How do I fix CVE-2025-29907?

To fix CVE-2025-29907, update jsPDF to version 3.0.1 or later.

3

What problem does CVE-2025-29907 cause in jsPDF?

CVE-2025-29907 allows an attacker to utilize unsanitized image URLs that can lead to denial of service.

4

Which versions of jsPDF are affected by CVE-2025-29907?

Versions of jsPDF prior to 3.0.1 are affected by CVE-2025-29907.

5

What methods in jsPDF are vulnerable due to CVE-2025-29907?

The addImage method in jsPDF is vulnerable to exploitation outlined in CVE-2025-29907.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203