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
CVE-2026-31938 affects jsPDF before 4.2.1. If an application lets an attacker influence PDF output options, malicious HTML can be injected into the browser window used to open the generated PDF. That can run script in the victim’s browser context, risking theft or modification of sensitive data.
Executive priority
Treat as urgent for customer-facing or internal web apps that generate PDFs from user-influenced data. The impact can include session or data compromise in the victim’s browser, but available sources do not confirm exploitation in the wild.
Technical view
The issue is CWE-79 HTML injection in jsPDF’s `output` function new-window paths. Unsanitized attacker-controlled `options` values can reach vulnerable overloads before 4.2.1. The CVSS 3.1 score is 9.6 because exploitation is network-reachable, low complexity, unauthenticated, user-assisted, and scope-changing.
Likely exposure
Exposure is likely in browser applications using parallax jsPDF versions below 4.2.1 where users, tenants, documents, templates, or form fields can influence values passed to `output` options and a victim opens the generated PDF in-browser.
Exploitation context
The source bundle does not show active exploitation, and KEV is false. Exploitation requires a victim to create and open a PDF using a vulnerable jsPDF path after attacker-controlled option values are passed without sanitization.
Researcher notes
The strongest evidence is the GitHub advisory, CVE record, fixing commit, and v4.2.1 release. Red Hat entries are referenced but the bundle does not provide product-specific impact details here. Do not assume non-jsPDF products are affected without vendor confirmation.
Mitigation direction
Upgrade jsPDF to version 4.2.1 or later.
Sanitize user-controlled input before passing it to `output` options.
Review vendor advisory and release notes for implementation-specific guidance.
Prioritize browser workflows that open generated PDFs in new windows.
Validation and detection
Inventory dependencies for `jspdf` versions below 4.2.1.
Search code for jsPDF `output` calls using dynamic options.
Trace whether user-controlled data can reach those options.
Confirm browser PDF-open flows use the patched dependency.
Document any remaining compensating sanitization controls.
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.