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 package | Versions | Reported by |
|---|---|---|
| parallax jsPDF | < 4.2.1 | 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.1 | GitHub Advisory Database |
| parall jspdf | before 4.2.1 | 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 | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| 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 | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N |
Classification
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:colorparameter
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
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31898 changed 2026-09-07 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-7x6v-j9x4-qf24 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-31898 changed 2026-08-18 | Public domain |