jsPDF
CVE-2026-25755
HIGH
Severity by source
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Network-delivered PDF (AV:N) with no auth (PR:N) but victim must open it (UI:R); primary effect is altering document structure/actions (I:H), with limited, viewer-sandboxed confidentiality and availability impact (C:L/A:L).
Primary rating from NVD.
CVSS VectorNVD
Lifecycle Timeline
11Blast Radius
ecosystem impact- 2 npm packages depend on jspdf (2 direct, 0 indirect)
Ecosystem-wide dependent count for version 4.2.0.
DescriptionNVD
jsPDF is a library to generate PDFs in JavaScript. Prior to 4.2.0, user control of the argument of the addJS method allows an attacker to inject arbitrary PDF objects into the generated document. By crafting a payload that escapes the JavaScript string delimiter, an attacker can execute malicious actions or alter the document structure, impacting any user who opens the generated PDF. The vulnerability has been fixed in jspdf@4.2.0. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the addJS method.
AnalysisAI
PDF object injection in the jsPDF JavaScript library (npm package 'jspdf', versions prior to 4.2.0) lets an attacker who controls the string passed to the addJS method break out of the PDF JavaScript string delimiter and inject arbitrary PDF dictionary objects, including auto-executing Additional Actions (/AA). Any user who later opens the generated PDF in a JavaScript-capable viewer executes the injected actions, affecting confidentiality, integrity and availability of their document session. Publicly available exploit code exists (a documented payload is published in the GitHub advisory), but EPSS is very low (0.04%, 10th percentile) and the issue is not in CISA KEV.
Technical ContextAI
jsPDF is a browser/Node.js library that programmatically builds PDF files. The addJS method is meant to embed document-level JavaScript (e.g. an autoprint action) by wrapping the supplied code inside a PDF string object of the form '/JS (...)'. Because the PDF string syntax uses parentheses as delimiters, the pre-4.2.0 code inserted the raw user string without escaping '(' and ')'. This is a classic CWE-94 (Improper Control of Generation of Code / Code Injection) root cause: untrusted data is concatenated into a structured serialization context without sanitization, so a ')' prematurely closes the JS string and following bytes ('>>', '/AA << ... >>') are parsed by the PDF reader as new objects rather than literal data. The affected component is the parall/parallax jsPDF package (CPE cpe:2.3:a:parall:jspdf:*:*:*:*:*:node.js:*:*). The 4.2.0 fix adds an escapeParens() routine that backslash-escapes only unescaped parentheses (avoiding double-escaping), so the entire payload stays inside the string literal.
RemediationAI
Vendor-released patch: 4.2.0 - upgrade the jspdf dependency to 4.2.0 or later (release https://github.com/parallax/jsPDF/releases/tag/v4.2.0, fixing commit 56b46d45b052346f5995b005a34af5dcdddd5437) and rebuild/redeploy any bundled front-end assets that vendor the library. Red Hat consumers should apply the platform errata RHSA-2026:7110 and RHSA-2026:7128. If you cannot upgrade immediately, the vendor-documented workaround is to escape parentheses in any user-provided JavaScript before passing it to addJS (replace '(' and ')' with their backslash-escaped forms, matching the library's own escapeParens logic), which neutralizes the string-breakout but must be applied consistently or it provides no protection; alternatively avoid feeding untrusted data into addJS at all, or strip/disallow document-level JavaScript in generated PDFs if the autoprint/scripting feature is not required, accepting the loss of that functionality.
Denial of service in jsPDF (npm package, all versions prior to 4.2.0) lets an attacker who can supply image input to the
PDF generation in jsPDF prior to version 4.1.0 allows injection of arbitrary PDF objects through unsanitized input passe
Denial of service in jsPDF prior to version 4.1.0 occurs when malicious BMP files with oversized dimension headers are p
In all versions of the package jspdf, it is possible to use <<script>script> in order to go over the filtering regex. Ra
All affected versions <2.0.0 of package jspdf are vulnerable to Cross-site Scripting (XSS). Rated medium severity (CVSS
Jspdf versions up to 4.1.0 contains a vulnerability that allows attackers to inject arbitrary XML (CVSS 5.4).
Local file inclusion and path traversal in the Node.js builds of jsPDF (dist/jspdf.node.js and dist/jspdf.node.min.js) p
jsPDF versions prior to 4.1.0 contain a race condition in the addJS method where a shared module-scoped variable is over
jsPDF versions prior to 4.2.0 allow attackers to inject arbitrary PDF objects including malicious JavaScript through uns
This affects the package jspdf before 2.3.1. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable,
jsPDF is a library to generate PDFs in JavaScript. Rated high severity (CVSS 8.7), this vulnerability is remotely exploi
jsPDF is a library to generate PDFs in JavaScript. Rated high severity (CVSS 8.7), this vulnerability is remotely exploi
Same weakness CWE-94 – Code Injection
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-9vjf-qc39-jprp