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 may let attacker-supplied PDF options place malicious HTML or scripts into a newly opened browser window. If a victim creates and opens the PDF, the script may read or alter sensitive information available in that browser context.
Executive priority
Treat this as an urgent application-security update where jsPDF runs in authenticated browser workflows or handles sensitive information. Identify exposed implementations promptly and upgrade them. The severity is critical, although exploitation requires a specific unsafe data flow and victim interaction, and the supplied evidence does not show active exploitation.
Technical view
CVE-2026-31938 is a CWE-79 HTML injection vulnerability in jsPDF versions earlier than 4.2.1. User-controlled values passed unsanitized through the output function's vulnerable new-window overloads can execute script when the generated PDF is opened. Exploitation requires victim interaction but crosses browser security scope, supporting the supplied CVSS 3.1 score of 9.6.
Likely exposure
Exposure is most likely in browser applications that use jsPDF earlier than 4.2.1, allow users to influence output options, and open generated PDFs through affected new-window paths. Applications that do not pass untrusted data into these options may not be practically exploitable, but their data flow still requires verification.
Exploitation context
An attacker must supply crafted option values that reach a victim's PDF-generation workflow, and the victim must create and open the PDF in a browser. The bundle marks the CVE as absent from KEV and provides no evidence of active exploitation. Public exploit availability is not established by the supplied sources.
Researcher notes
Assessment should focus on call sites using output overloads that open PDFs in a browser context, including wrappers that pass options automatically. Confirm whether attacker-controlled fields can reach the options object without sanitization. The source bundle identifies the fix release and commit, but does not enumerate every vulnerable overload or establish exploitation in the wild.
Mitigation direction
Upgrade jsPDF to version 4.2.1 or later.
Until upgraded, sanitize all user-controlled values before passing them to the output method.
Prevent untrusted users from controlling PDF output options or related new-window parameters.
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.