jsPDF Flaw Exposes Millions of Developers to Object Injection
A significant security vulnerability has been identified in jsPDF, a JavaScript library used for generating PDFs within web browsers. This flaw, CVE-2026-25755, poses potential risks to millions of developers and users.
A significant security vulnerability has been identified in jsPDF, a JavaScript library used for generating PDFs within web browsers. This flaw, CVE-2026-25755, poses potential risks to millions of developers and users.
The vulnerability, with a CVSS score of 8.8 (High severity), allows for PDF Object Injection via the library's addJS method. This impacts numerous web applications that utilize jsPDF for creating dynamic PDFs from user data. The core issue is in the javascript.js file of jsPDF, where the addJS method directly concatenates user input into a PDF stream without proper sanitization. The vulnerable code is as follows: this.internal.out("/JS (" + text + ")"); .
JavaScript-Independent Execution: Malicious actions can be triggered even if JavaScript is disabled in the PDF viewer. Document Structure Tampering: Attackers can alter document metadata or enable phishing attacks by injecting objects. Cross-Viewer Payload Reliability: Injected objects execute consistently across different platforms.
CVE ID CVSS Score Description
A significant security vulnerability has been identified in jsPDF, a JavaScript library used for generating PDFs within web browsers.
CVE-2026-25755 8.8 (High) PDF Object Injection due to unsanitized input in jsPDF's addJS method.
The vulnerability affects jsPDF versions below 4.1.0. It is recommended to upgrade to version 4.1.0 or later, which resolves the issue by escaping parentheses and backslashes according to PDF specifications.
Affected Versions Patched Versions
< 4.1.0
= 4.1.0
Developers should validate all inputs and regularly scan dependencies using tools such as npm audit or Snyk. Testing generated PDFs in various viewers is advised to detect anomalies. Enterprises using jsPDF in production are urged to apply patches promptly to mitigate risks of potential attacks.
Based on reporting by GBHackers.
