CVE-2026-31938

jsPDF is a library to generate PDFs in JavaScript. Prior to version 4.2.1, user control of the `options` argument of the `output` function allows attackers to inject arbitrary HTML (such as scripts) into the browser context the created PDF is opened in. The vulnerability can be exploited in the following scenario: the attacker provides values for the output options, for example via a web interface. These values are then passed unsanitized (automatically or semi-automatically) to the attack victim. The victim creates and opens a PDF with the attack vector using one of the vulnerable method overloads inside their browser. The attacker can thus inject scripts that run in the victims browser context and can extract or modify secrets from this context. The vulnerability has been fixed in jspdf@4.2.1. As a workaround, sanitize user input before passing it to the output method.
Configurations

Configuration 1 (hide)

cpe:2.3:a:parall:jspdf:*:*:*:*:*:node.js:*:*

History

18 Mar 2026, 18:02

Type Values Removed Values Added
First Time Parall
Parall jspdf
CPE cpe:2.3:a:parall:jspdf:*:*:*:*:*:node.js:*:*
References () https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7 - () https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7 - Patch
References () https://github.com/parallax/jsPDF/releases/tag/v4.2.1 - () https://github.com/parallax/jsPDF/releases/tag/v4.2.1 - Product, Release Notes
References () https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5 - () https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5 - Mitigation, Vendor Advisory

18 Mar 2026, 14:52

Type Values Removed Values Added
Summary
  • (es) jsPDF es una biblioteca para generar PDFs en JavaScript. Antes de la versión 4.2.1, el control del usuario sobre el argumento 'options' de la función 'output' permite a los atacantes inyectar HTML arbitrario (como scripts) en el contexto del navegador en el que se abre el PDF creado. La vulnerabilidad puede ser explotada en el siguiente escenario: el atacante proporciona valores para las opciones de salida, por ejemplo, a través de una interfaz web. Estos valores se pasan luego sin sanear (automática o semi-automáticamente) a la víctima del ataque. La víctima crea y abre un PDF con el vector de ataque utilizando una de las sobrecargas de método vulnerables dentro de su navegador. El atacante puede así inyectar scripts que se ejecutan en el contexto del navegador de la víctima y puede extraer o modificar secretos de este contexto. La vulnerabilidad ha sido corregida en jspdf@4.2.1. Como solución alternativa, sanear la entrada del usuario antes de pasarla al método de salida.

18 Mar 2026, 04:17

Type Values Removed Values Added
New CVE

Information

Published : 2026-03-18 04:17

Updated : 2026-03-18 18:02


NVD link : CVE-2026-31938

Mitre link : CVE-2026-31938

CVE.ORG link : CVE-2026-31938


JSON object : View

Products Affected

parall

  • jspdf
CWE
CWE-79

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')