CVE-2026-31898
JSON

8.1high

jsPDF has a PDF Object Injection via FreeText color

Severity
8.1high CVSS:3.1 by GitHub_M
Exploit likelihood
0.43% (higher than 38% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-7x6v-j9x4-qf24

Description

jsPDF is a library to generate PDFs in JavaScript. Prior to version 4.2.1, user control of arguments of the `createAnnotation` method allows users to inject arbitrary PDF objects, such as JavaScript actions. If given the possibility to pass unsanitized input to the following method, a user can inject arbitrary PDF objects, such as JavaScript actions, which might trigger when the PDF is opened or interacted with the `createAnnotation`: `color` parameter. The vulnerability has been fixed in jsPDF@4.2.1. As a workaround, sanitize user input before passing it to the vulnerable API members.

Affected

Product or packageVersionsReported by
parallax jsPDF< 4.2.1CVE List
advanced-cluster-security/rhacs-main-rhel8Not specified
Not affected: from 1775594119 before *, from 1775594284 before *
CVE List
jspdf (npm)before 4.2.1GitHub Advisory Database
parall jspdfbefore 4.2.1NVD

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-SADP8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
GitHub8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

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 version 4.2.1, user control of arguments of the `createAnnotation` method allows users to inject arbitrary PDF objects, such as JavaScript actions. If given the possibility to pass unsanitized input to the following method, a user can inject arbitrary PDF objects, such as JavaScript actions, which might trigger when the PDF is opened or interacted with the `createAnnotation`: `color` parameter. The vulnerability has been fixed in jsPDF@4.2.1. As a workaround, sanitize user input before passing it to the vulnerable API members.

GitHub Advisory Database
Impact

User control of arguments of the createAnnotation method allows users to inject arbitrary PDF objects, such as JavaScript actions.

If given the possibility to pass unsanitized input to the following method, a user can inject arbitrary PDF objects, such as JavaScript actions, which might trigger when the PDF is opened or interacted with..

  • createAnnotation: color parameter

Example attack vector:

import { jsPDF } from 'jspdf'

const doc = new jsPDF();

const payload = '000000) /AA <</E <</S /Launch /F (calc.exe)>>>> (';

doc.createAnnotation({
  type: 'freetext',
  bounds: { x: 10, y: 10, w: 120, h: 20 },
  contents: 'hello',
  color: payload
});

doc.save('test.pdf');
Patches

The vulnerability has been fixed in jsPDF@4.2.1.

Workarounds

Sanitize user input before passing it to the vulnerable API members.

NVD (es)

jsPDF es una biblioteca para generar PDFs en JavaScript. Anterior a la versión 4.2.1, el control del usuario sobre los argumentos del método 'createAnnotation' permite a los usuarios inyectar objetos PDF arbitrarios, como acciones de JavaScript. Si se le da la posibilidad de pasar entrada no saneada al siguiente método, un usuario puede inyectar objetos PDF arbitrarios, como acciones de JavaScript, que podrían activarse cuando el PDF se abre o se interactúa con el 'createAnnotation': parámetro 'color'. La vulnerabilidad ha sido corregida en jsPDF@4.2.1. Como solución alternativa, sanee la entrada del usuario antes de pasarla a los miembros vulnerables de la API.

References

https://github.com/parallax/jsPDF/security/advisories/GHSA-7x6v-j9x4-qf24mitigation, vendor-advisory, web
https://github.com/parallax/jsPDF/commit/4155c4819d5eca284168e51e0e1e81126b4f14b8patch, web
https://github.com/parallax/jsPDF/blob/b1607a9391d4cd65ea7ade25998aea8345ae1be3/src/modules/annotations.js#L193-L208patch, web
https://github.com/parallax/jsPDF/releases/tag/v4.2.1release-notes, web
https://access.redhat.com/security/cve/CVE-2026-31898vdb-entry
https://bugzilla.redhat.com/show_bug.cgi?id=2448547issue-tracking
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-31898.json
https://access.redhat.com/errata/RHSA-2026:7110vendor-advisory
https://access.redhat.com/errata/RHSA-2026:7128vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2026-31898advisory
https://github.com/parallax/jsPDFpackage

Sources

SourceRecordLicence
CVE ListCVE-2026-31898 changed 2026-09-07CVE Terms of Use
GitHub Advisory DatabaseGHSA-7x6v-j9x4-qf24 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-31898 changed 2026-08-18Public domain