NodeJS/jspdf/1.4.1


PDF Document creation from JavaScript

https://www.npmjs.com/package/jspdf
MIT

4 Security Vulnerabilities

Cross-site scripting in jspdf

Published date: 2021-05-11T16:43:52Z
CVE: CVE-2020-7691
Links:

It's possible to use nested script tags in order to bypass the filtering regex.

Affected versions: ["1.0.272", "1.2.60", "1.2.61", "1.3.0", "1.3.1", "1.4.0", "1.5.1", "1.5.2", "1.5.3", "1.1.135", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.4.1"]
Secure versions: [3.0.1, 3.0.2, 3.0.3]
Recommendation: Update to version 3.0.3.

jspdf vulnerable to Regular Expression Denial of Service (ReDoS)

Published date: 2021-03-12T21:28:46Z
CVE: CVE-2021-23353
Links:

This affects the package jspdf before 2.3.1. ReDoS is possible via the addImage function.

Affected versions: ["1.0.272", "1.2.60", "1.2.61", "1.3.0", "1.3.1", "1.4.0", "1.5.1", "1.5.2", "1.5.3", "2.0.0", "2.1.1", "1.1.135", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.4.1", "2.1.0", "2.2.0", "2.3.0"]
Secure versions: [3.0.1, 3.0.2, 3.0.3]
Recommendation: Update to version 3.0.3.

Cross-site scripting in jspdf

Published date: 2021-05-17T21:01:32Z
CVE: CVE-2020-7690
Links:

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). It's possible to inject JavaScript code via the html method.

Affected versions: ["1.0.272", "1.2.60", "1.2.61", "1.3.0", "1.3.1", "1.4.0", "1.5.1", "1.5.2", "1.5.3", "1.1.135", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.4.1"]
Secure versions: [3.0.1, 3.0.2, 3.0.3]
Recommendation: Update to version 3.0.3.

jsPDF Bypass Regular Expression Denial of Service (ReDoS)

Published date: 2025-03-18T21:07:47Z
CVE: CVE-2025-29907
Links:

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 versions: ["1.0.272", "1.2.60", "1.2.61", "1.3.0", "1.3.1", "1.4.0", "1.5.1", "1.5.2", "1.5.3", "2.0.0", "2.1.1", "1.1.135", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.4.1", "2.1.0", "2.2.0", "2.3.0", "2.3.1", "2.4.0", "2.5.0", "2.5.1", "2.5.2", "3.0.0"]
Secure versions: [3.0.1, 3.0.2, 3.0.3]
Recommendation: Update to version 3.0.3.

29 Other Versions

Version License Security Released
3.0.3 MIT 2025-09-18 - 08:09 21 days
3.0.2 MIT 2025-08-26 - 11:58 about 1 month
3.0.1 MIT 2025-03-18 - 09:07 7 months
3.0.0 MIT 1 2025-02-19 - 09:39 8 months
2.5.2 MIT 1 2024-09-17 - 13:38 about 1 year
2.5.1 MIT 1 2022-01-28 - 15:56 over 3 years
2.5.0 MIT 1 2021-12-21 - 09:59 almost 4 years
2.4.0 MIT 1 2021-09-14 - 11:35 about 4 years
2.3.1 MIT 1 2021-03-09 - 08:44 over 4 years
2.3.0 MIT 2 2021-01-15 - 16:10 over 4 years
2.2.0 MIT 2 2020-12-07 - 14:50 almost 5 years
2.1.1 MIT 2 2020-09-07 - 13:54 about 5 years
2.1.0 MIT 2 2020-08-25 - 16:10 about 5 years
2.0.0 MIT 2 2020-08-11 - 08:55 about 5 years
1.5.3 MIT 4 2018-12-27 - 14:13 almost 7 years
1.5.2 MIT 4 2018-12-20 - 15:49 almost 7 years
1.5.1 MIT 4 2018-12-20 - 15:42 almost 7 years
1.4.1 MIT 4 2018-06-06 - 07:54 over 7 years
1.4.0 MIT 4 2018-05-21 - 16:55 over 7 years
1.3.5 MIT 4 2017-09-14 - 15:10 about 8 years
1.3.4 MIT 4 2017-09-14 - 14:17 about 8 years
1.3.3 MIT 4 2017-02-23 - 15:32 over 8 years
1.3.2 MIT 4 2016-09-30 - 20:34 about 9 years
1.3.1 MIT 4 2016-09-30 - 20:28 about 9 years
1.3.0 MIT 4 2016-09-28 - 10:59 about 9 years
1.2.61 MIT 4 2016-03-01 - 16:16 over 9 years
1.2.60 MIT 4 2016-02-29 - 18:52 over 9 years
1.1.135 MIT 4 2016-02-29 - 18:51 over 9 years
1.0.272 MIT 4 2015-05-19 - 00:28 over 10 years