Skip to main content

EUVDEUVD-2026-12755

| CVE-2026-31938 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-03-17 https://github.com/parallax/jsPDF GHSA-wfv2-pwc8-crg5
6.1
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker provides malicious options argument
  2. Exploit
    options JSON-serialized into generated HTML
  3. Execution
    HTML opened in browser context
  4. Impact
    Arbitrary JavaScript executes in PDF viewer

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Application must use output function with user-controlled options argument in pdfObjectNewWindow, pdfJsNewWindow, or dataUrlNewWindow overloads. Attacker controls pdfObjectUrl, pdfJsUrl, filename, or entire options object. User must open resulting PDF in browser.

Impact

While the CVSS 3.1 score of 9.6 indicates critical severity with network attack vector, low complexity, and no privileges required, the real-world risk is moderated by the user interaction requirement. The vulnerability requires an attacker to control input options AND convince a victim to open the resulting PDF, making it a two-stage attack. No KEV listing or EPSS data suggests this is not being actively exploited in the wild. The availability of a public proof-of-concept increases the risk of opportunistic attacks, but the requirement for social engineering and specific application configurations that pass unsanitized user input to jsPDF output methods limits the attack surface compared to other critical XSS vulnerabilities.

Exploit ScenarioDerived

An attacker creates a web form that allows users to customize PDF generation settings, injecting malicious JavaScript into the filename parameter. When a victim administrator uses this feature to generate a report, the malicious script executes in their browser context, potentially stealing session tokens or performing unauthorized actions. The provided proof-of-concept demonstrates this attack by injecting an iframe and script tag through the filename option in the pdfjsnewwindow output method.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Mar 17, 2026

HTML injection in PDF output functions allows remote attackers to execute arbitrary scripts in the browser context where generated PDFs are opened, exploitable when untrusted user input is passed unsanitized to the pdfObjectUrl, pdfJsUrl, or filename options. An attacker can craft malicious values through a web interface that, when used by victims to generate and open PDFs, execute arbitrary JavaScript in their browser with high impact on confidentiality and integrity. A patch is available to remediate this critical vulnerability affecting all users who process user-controlled PDF output parameters.

Earlier versions of this analysis (1)
v1 Mar 17, 2026 - 20:30 CVSS 9.6

A cross-site scripting (XSS) vulnerability in the jsPDF JavaScript library allows attackers to inject arbitrary HTML and JavaScript code when PDF output options are controlled by user input. The vulnerability affects jsPDF versions before 4.2.1 and can be exploited when an attacker tricks a victim into opening a maliciously crafted PDF using specific output methods, potentially allowing extraction or modification of sensitive data from the victim's browser context. A proof-of-concept exploit is publicly available and the vulnerability has a critical CVSS score of 9.6, though no active exploitation has been reported.

RemediationAI

Upgrade jsPDF to version 4.2.1 or later, which contains the security fix (commit 87a40bbd07e6b30575196370670b41f264aa78d7). The patched version is available at https://github.com/parallax/jsPDF/releases/tag/v4.2.1. As an immediate workaround, sanitize all user input before passing it to the jsPDF output method, particularly the filename, pdfObjectUrl, and pdfJsUrl parameters. Implement content security policies (CSP) to limit the impact of any successful XSS attacks and validate that user-controlled data cannot reach the vulnerable output methods.

Affected VersionsENISA

jsPDF < 4.2.1

Affected Packages

npm jspdf fix: 4.2.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The jsPDF library (npm:jspdf) is a popular JavaScript library for generating PDF documents in web applications. The vulnerability stems from improper neutralization of input during web page generation (CWE-79), where user-controlled options passed to the output function are included directly in generated HTML without proper sanitization. The affected methods include pdfobjectnewwindow, pdfjsnewwindow, and dataurlnewwindow output overloads, where options like pdfObjectUrl, pdfJsUrl, and filename parameters can contain malicious scripts that execute when the PDF is opened in a browser context.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Red Hat 8.1 HIGH

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

4
Severity Changed
Jun 30, 2026 - 03:24 NVD
CRITICAL MEDIUM
CVSS changed
Jun 30, 2026 - 03:24 NVD
9.6 (CRITICAL) 6.1 (MEDIUM)
Patch released
Mar 17, 2026 - 20:30 nvd
Patch available
CVE Published
Mar 17, 2026 - 17:07 nvd
CRITICAL 9.6

DescriptionNVD

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:

js
import { jsPDF } from 'jspdf';
const doc = new jsPDF();

const payload =  'x\"></iframe><script>window.__n=1</script><iframe src="';

doc.output('pdfjsnewwindow', {
  filename: payload,
  pdfJsUrl: 'viewer.html'
});

Patches

The vulnerability has been fixed in jspdf@4.2.1.

Workarounds

Sanitize user input before passing it to the output method.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 810 npm packages depend on jspdf (518 direct, 297 indirect)

Ecosystem-wide dependent count for version 4.2.1.

Executive ViewAI

Why It Matters

A critical vulnerability in the jsPDF library (CVE-2026-31938, CVSS 9.6) allows attackers to inject malicious code through PDF files, potentially compromising user data and browser sessions. Any application using jsPDF versions before 4.2.1 requires immediate patching to prevent data theft or unauthorized access to sensitive information.

Business Impact: Severe
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.0%
Top 89% exploitable
Data Quality
7 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
Very High

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Related Vulnerabilities in PDF Generation HTML Injection

View all 2

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy