CVE-2026-25755
Undergoing Analysis Undergoing Analysis - In Progress
JavaScript Injection in jsPDF addJS Method Allows PDF Manipulation

Publication date: 2026-02-19

Last updated on: 2026-02-23

Assigner: GitHub, Inc.

Description
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 [email protected]. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the `addJS` method.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-02-19
Last Modified
2026-02-23
Generated
2026-05-07
AI Q&A
2026-02-19
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
parall jspdf to 4.2.0 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-116 The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
CWE-94 The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

The vulnerability exists in the jsPDF library versions prior to 4.2.0, specifically in the `addJS` method. This method allows users to add JavaScript code to the generated PDF. However, because user input is not properly sanitized, an attacker can craft a payload that escapes the JavaScript string delimiter. This enables the injection of arbitrary PDF objects into the document, potentially allowing malicious actions or alteration of the PDF's structure when the document is opened.


How can this vulnerability impact me? :

If you use a vulnerable version of jsPDF and allow user input to be passed to the `addJS` method without proper escaping, an attacker can inject malicious code into the generated PDF. This can lead to execution of harmful actions when the PDF is opened, or manipulation of the document's content and structure. Such impacts can affect any user who opens the compromised PDF, potentially leading to security breaches or data integrity issues.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

I don't know


What immediate steps should I take to mitigate this vulnerability?

To mitigate this vulnerability, upgrade the jsPDF library to version 4.2.0 or later where the issue is fixed.

As a workaround, escape parentheses in any user-provided JavaScript code before passing it to the addJS method to prevent injection.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart