CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L
Lifecycle Timeline
4Tags
Description
### 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 [email protected]. ### Workarounds Sanitize user input before passing it to the output method.
Analysis
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. …
Sign in for full analysis, threat intelligence, and remediation guidance.
Remediation
Within 24 hours: Identify all applications and services using jsPDF and document their current versions. Within 7 days: Apply vendor patch to upgrade jsPDF to version 4.2.1 or later across all affected systems; prioritize internet-facing and customer-facing applications. …
Sign in for detailed remediation steps.
Priority Score
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-12755
GHSA-wfv2-pwc8-crg5