CVE-2026-25755: jsPDF has PDF Object Injection via Unsanitized Input in addJS Method
Impact
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.
js import { jsPDF } from "jspdf"; const doc = new jsPDF(); // Payload: // 1. ) closes the JS string. // 2. > closes the current dictionary. // 3. /AA ... injects an "Additional Action" that executes on focus/open. const maliciousPayload = "console.log('test');) >> /AA << /O << /S /JavaScript /JS (app.alert('Hacked!')) >> >>";
doc.addJS(maliciousPayload); doc.save("vulnerable.pdf");
Patches The vulnerability has been fixed in jspdf@4.2.0.
Workarounds Escape parentheses in user-provided JavaScript code before passing them to the addJS method. References https://github.com/ZeroXJacks/CVEs/blob/main/2026/CVE-2026-25755.md
Other sources
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.0. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the addJS method.
— Red Hat
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.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/jspdfto a version that resolves this vulnerability.Fixed in 4.2.0 - Upgrade
Upgrade
jspdfto a version that resolves this vulnerability.Fixed in 4.2.0 - Configuration
As a workaround, escape parentheses in user-provided JavaScript code before passing it to the jsPDF addJS method.
jsPDF (addJS) user_provided_js_input = escape_parens
Event History
Frequently Asked Questions
What is the severity of CVE-2026-25755?
CVE-2026-25755 is classified as a high severity vulnerability due to the potential for PDF Object Injection.
How do I fix CVE-2026-25755?
To fix CVE-2026-25755, upgrade to jsPDF version 4.2.0 or later, which addresses the issue.
What are the exploitation risks of CVE-2026-25755?
Exploitation of CVE-2026-25755 can allow attackers to inject arbitrary PDF objects, potentially leading to information disclosure or further attacks.
Which versions of jsPDF are affected by CVE-2026-25755?
CVE-2026-25755 affects all versions of jsPDF prior to 4.2.0.
What is the main vulnerability in CVE-2026-25755?
The main vulnerability in CVE-2026-25755 is unsanitized input in the addJS method, allowing for PDF Object Injection.