Skip to content

← Actionable
Critical, CVSS 9.6amended

jsPDF has HTML Injection in New Window paths

CVE-2026-31938GHSA-wfv2-pwc8-crg5

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (jspdf 4.2.1), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

  • npm jspdf

    Affected
    <= 4.2.0
    Fixed in
    4.2.1

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS
9.6 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L
EPSS
  • CVE-2026-31938: 0.27% estimated exploitation activity in the next 30 days; percentile 19.88 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description

As published by the source; long descriptions are shortened.

Impact 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 affected overloads and options are: "pdfobjectnewwindow": the pdfObjectUrl option and the entire options object, which is JSON-serialized and included verbatim in the generated HTML-string. "pdfjsnewwindow": the pdfJsUrl and filename options "dataurlnewwindow": the filename option 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. Example attack vector:…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 3 · amended ·

    Amended from ghsa record GHSA-wfv2-pwc8-crg5

  2. Revision 2 · amended ·

    Amended from osv record GHSA-wfv2-pwc8-crg5

  3. Revision 1 · created ·

    Published from ghsa record GHSA-wfv2-pwc8-crg5

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: CVE-2026-31938

Advisory: jsPDF has HTML Injection in New Window paths
IDs: CVE-2026-31938, GHSA-wfv2-pwc8-crg5
Record: https://patchnext.com/advisories/cve-2026-31938 (revision 3, source checked 26 Oct 2026, 12:46 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Critical (CVSS 9.6)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: jspdf 4.2.1. A vendor fix does not mean a deployment is fixed.

## Affected components
- npm jspdf: affected <= 4.2.0; fixed in 4.2.1

## Suggested inspection (read-only)
- `npm ls jspdf --all`: lists every installed copy and version, including transitive ones. Run in the project root after `npm ci`.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on jspdf.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://github.com/advisories/GHSA-wfv2-pwc8-crg5 (GitHub-reviewed advisory GHSA-wfv2-pwc8-crg5 lists affected ranges: npm jspdf >=0 <=4.2.0)
- Verified: https://osv.dev/vulnerability/GHSA-wfv2-pwc8-crg5 (OSV record GHSA-wfv2-pwc8-crg5 lists affected ranges: npm jspdf >=0 <4.2.1 (fixed))

Commands are suggestions: review each one before running it.

Loading voting…