CVE-2026-24040: jsPDF has a Shared State Race Condition in addJS Plugin

Published Feb 2, 2026
·
Updated

Impact

The addJS method in the jspdf Node.js build utilizes a shared module-scoped variable (text) to store JavaScript content. When used in a concurrent environment (e.g., a Node.js web server), this variable is shared across all requests.

If multiple requests generate PDFs simultaneously, the JavaScript content intended for one user may be overwritten by a subsequent request before the document is generated. This results in Cross-User Data Leakage, where the PDF generated for User A contains the JavaScript payload (and any embedded sensitive data) intended for User B.

Typically, this only affects server-side environments, although the same race conditions might occur if jsPDF runs client-side.

js import { jsPDF } from "jspdf";

const docA = new jsPDF(); const docB = new jsPDF();

// 1. User A sets their script (stored in shared 'text' variable) docA.addJS('console.log("Secret A");');

// 2. User B sets their script (overwrites shared 'text' variable) docB.addJS('console.log("Secret B");');

// 3. User A saves their PDF (reads current 'text' variable) docA.save("userA.pdf");

// Result: userA.pdf contains "Secret B" instead of "Secret A"

Patches The vulnerability has been fixed in jspdf@4.0.1. The fix moves the shared variable into the function scope, ensuring isolation between instances.

Workarounds Avoid using the addJS method in concurrent server-side environments. If usage is required, ensure requests are processed sequentially (e.g., using a queue) rather than in parallel.

Other sources

jsPDF is a library to generate PDFs in JavaScript. Prior to 4.1.0, the addJS method in the jspdf Node.js build utilizes a shared module-scoped variable (text) to store JavaScript content. When used in a concurrent environment (e.g., a Node.js web server), this variable is shared across all requests. If multiple requests generate PDFs simultaneously, the JavaScript content intended for one user may be overwritten by a subsequent request before the document is generated. This results in Cross-User Data Leakage, where the PDF generated for User A contains the JavaScript payload (and any embedded sensitive data) intended for User B. Typically, this only affects server-side environments, although the same race conditions might occur if jsPDF runs client-side. The vulnerability has been fixed in jsPDF@4.1.0.

MITRE

Affected Software

2 affected componentsFixes available
npm/jspdf<=4.0.0
4.1.0
parall jspdf Node.js<4.1.0

Event History

Feb 2, 2026
Advisory Published
via GitHub·06:20 PM
Data Sourced
via GitHub·06:20 PM
DescriptionWeaknessAffected Software
CVE Published
via MITRE·08:38 PM
Data Sourced
via MITRE·08:38 PM
DescriptionWeakness
Data Sourced
via NVD·11:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:16 PM
RemedyAffected 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-2026-24040?

CVE-2026-24040 is categorized as a moderate severity vulnerability due to its potential impact in a concurrent environment.

2

How do I fix CVE-2026-24040?

To fix CVE-2026-24040, update the jsPDF package to version 4.1.0 or later.

3

What systems are affected by CVE-2026-24040?

CVE-2026-24040 affects versions of the jsPDF package up to and including 4.0.0.

4

What impact does CVE-2026-24040 have on applications?

CVE-2026-24040 can lead to incorrect PDF generation when multiple requests are processed simultaneously.

5

Is CVE-2026-24040 a critical vulnerability?

No, CVE-2026-24040 is not classified as critical but poses a risk in high concurrency situations.

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