8.1high
jsPDF has PDF Object Injection via Unsanitized Input in addJS Method
- Severity
- 8.1high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.94% (higher than 61% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9vjf-qc39-jprp
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 jspdf@4.2.0. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the `addJS` method.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| parallax jsPDF | < 4.2.0 | CVE List |
| advanced-cluster-security/rhacs-main-rhel8 | Not specified Not affected: from 1775594119 before *, from 1775594284 before * | CVE List |
| jspdf (npm) | before 4.2.0 | GitHub Advisory Database |
| parall jspdf | before 4.2.0 | NVD |
All scores
| GitHub_M | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| redhat-SADP | 9.6critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
| GitHub | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
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.
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
NVD (es)
jsPDF es una librería para generar PDFs en JavaScript. Antes de la versión 4.2.0, el control del usuario sobre el argumento del método `addJS` permite a un atacante inyectar objetos PDF arbitrarios en el documento generado. Al elaborar una carga útil que escapa el delimitador de cadena de JavaScript, un atacante puede ejecutar acciones maliciosas o alterar la estructura del documento, lo que afecta a cualquier usuario que abra el PDF generado. La vulnerabilidad ha sido corregida en jspdf@4.2.0. Como solución alternativa, escape los paréntesis en el código JavaScript proporcionado por el usuario antes de pasarlos al método `addJS`.
References
| https://github.com/parallax/jsPDF/security/advisories/GHSA-9vjf-qc39-jprp | vendor-advisory, web | |
| https://github.com/parallax/jsPDF/commit/56b46d45b052346f5995b005a34af5dcdddd5437 | patch, web | |
| https://github.com/ZeroXJacks/CVEs/blob/main/2026/CVE-2026-25755.md | exploit, mitigation, third-party-advisory, web | |
| https://github.com/parallax/jsPDF/releases/tag/v4.2.0 | release-notes, web | |
| https://access.redhat.com/security/cve/CVE-2026-25755 | vdb-entry | |
| https://bugzilla.redhat.com/show_bug.cgi?id=2440993 | issue-tracking | |
| https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25755.json | ||
| https://access.redhat.com/errata/RHSA-2026:7110 | vendor-advisory | |
| https://access.redhat.com/errata/RHSA-2026:7128 | vendor-advisory | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-25755 | advisory | |
| https://github.com/parallax/jsPDF | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-25755 changed 2026-09-07 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9vjf-qc39-jprp changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-25755 changed 2026-08-18 | Public domain |