CVE-2026-25755
JSON

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 packageVersionsReported by
parallax jsPDF< 4.2.0CVE List
advanced-cluster-security/rhacs-main-rhel8Not specified
Not affected: from 1775594119 before *, from 1775594284 before *
CVE List
jspdf (npm)before 4.2.0GitHub Advisory Database
parall jspdfbefore 4.2.0NVD

All scores

GitHub_M8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
redhat-SADP9.6critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
GitHub8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-94CWE-116

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

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

Sources

SourceRecordLicence
CVE ListCVE-2026-25755 changed 2026-09-07CVE Terms of Use
GitHub Advisory DatabaseGHSA-9vjf-qc39-jprp changed 2026-09-10CC-BY-4.0
NVDCVE-2026-25755 changed 2026-08-18Public domain