Security Digest · Vulnerability record
CVE-2026-31938: jsPDF has HTML Injection in New Window paths
jsPDF is a library to generate PDFs in JavaScript.
CVSS 9.6 Critical EPSS 0.4% · p35
Should you act?
Critical and remotely reachable
No known exploitation yet, but it is network-reachable without credentials. This signal is computed from CISA KEV, EPSS and CVSS data; it is not an editorial verdict.
- No confirmed exploitation. It is not in CISA’s KEV catalog and CISA’s SSVC assessment records no known exploitation. That can change quickly after a public write-up; re-check if you are affected.
- EPSS 0.4%, percentile 35: FIRST’s model estimates a 0.4% chance of exploitation activity in the next 30 days, higher than 35% of all scored CVEs (low). EPSS is a probability, not a verdict.
- Needs a user to click or open something. Phishing makes that realistic, but it is not wormable.
- Only applies if your dependency tree includes
jspdf(npm) <= 4.2.0, fixed in 4.2.1. Check your lockfile, including transitive dependencies.
What it is
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.
From the GitHub advisory
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:
Weakness type: CWE-79.
Product: jspdf (npm) · Assigned by: GitHub_M · Published: 2026-03-18
Affected and fixed versions
| Ecosystem | Package | Vulnerable | First fixed |
|---|---|---|---|
| npm | jspdf | <= 4.2.0 | 4.2.1 |
| Vendor | Product | Affected versions (per CVE record) |
|---|---|---|
| parallax | jsPDF | < 4.2.1 |
Severity scores
| Scored by | CVSS | Score | Vector |
|---|---|---|---|
| GitHub_M | 3.1 | 9.6 Critical | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L |
| redhat-SADP | 3.1 | 8.1 High | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| GitHub | 3.1 | 9.6 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L |
- Attack vector: network (remotely reachable)
- Attack complexity: low
- Privileges required: none (no login)
- User interaction: required (a user must click/open something)
- Scope: changed (can affect other components)
CVSS measures how bad a flaw is if exploited, not how likely exploitation is. Read it next to the exploitation data below.
Exploitation and urgency
- CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
- CISA SSVC assessment: exploitation none, automatable no, technical impact total.
- FIRST EPSS (model of 2026-10-21): 0.42% probability of exploitation activity in the next 30 days; percentile 35.
Timeline
- — GitHub-reviewed advisory GHSA-wfv2-pwc8-crg5 published (critical)
- — CVE record published by GitHub_M
- — CVE record last updated
Sources and references
Original sources first. Version and fix details should always be confirmed against the vendor or project advisory.
Vendor and project advisories, patches
- access.redhat.com access.redhat.com
- access.redhat.com access.redhat.com
Vulnerability records
- GitHub Advisory GHSA-wfv2-pwc8-crg5 github.com
- CVE.org record CVE-2026-31938 cve.org
- NVD entry CVE-2026-31938 nvd.nist.gov
Other references from the CVE record and advisory
- github.com github.com
- github.com github.com
- github.com github.com
- access.redhat.com access.redhat.com
- RHBZ#2448550 bugzilla.redhat.com
- security.access.redhat.com security.access.redhat.com