CVE-2026-31938: jsPDF has HTML Injection in New Window paths
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.
Security readout for executives and security teams
Plain-English summary
Applications using jsPDF before 4.2.1 can let attacker-supplied PDF output options inject HTML into a browser window opened for the generated PDF. If a user is tricked into generating and opening that PDF, scripts may run in that user's browser context, risking theft or modification of secrets.
Executive priority
Treat as urgent where jsPDF handles user-influenced PDF settings in browser workflows. The issue can cross into the user's browser context and has a critical CVSS score, but active exploitation is not established in the supplied evidence.
Technical view
CVE-2026-31938 is CWE-79 HTML injection in jsPDF's output function new-window paths. When untrusted options are passed unsanitized to vulnerable overloads, attacker-controlled HTML, including scripts, can execute in the victim browser context. The vendor-fixed version is jspdf 4.2.1.
Likely exposure
Exposure is most likely in web applications that accept or derive jsPDF output options from users, templates, saved configurations, links, or workflow data before opening generated PDFs in-browser.
Exploitation context
The source bundle describes a user-interaction scenario: the attacker controls output options, and the victim creates and opens the PDF in a browser. KEV is false, and the provided sources do not confirm active exploitation.
Researcher notes
Focus review on data flow into the output options argument and vulnerable method overloads that open generated PDFs. The commit and 4.2.1 release are the clearest remediation anchors. Avoid assuming exploitability where options are fully server-controlled or sanitized.
Mitigation direction
Upgrade jspdf to version 4.2.1 or later.
Sanitize untrusted input before passing it to the output method.
Review web interfaces that expose PDF output options to users.
Check Red Hat advisories if using jsPDF through Red Hat-distributed software.
Validation and detection
Inventory frontend and server packages for jspdf versions below 4.2.1.
Search code for jsPDF output calls receiving user-controlled options.
Verify PDF creation flows that open output in a new browser window.
Confirm dependency updates are present in lockfiles and deployed builds.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-79: User-session and phishing behavior lookup
Client-side and session-facing weaknesses should be reviewed alongside initial-access and user-execution behaviors. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
2ADP providers
9Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-79 · source CWE mapping
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.