CVE-2026-25755
JavaScript Injection in jsPDF addJS Method Allows PDF Manipulation
Publication date: 2026-02-19
Last updated on: 2026-02-23
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| parall | jspdf | to 4.2.0 (exc) |
Helpful Resources
Exploitability
| 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.