CVE-2026-31938
mediumpriority · track · 24EPSS 0.003 · 20 %ileDEEURUUSEPSS · scored 2026-10-27
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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · medium–critical · 5.6–9.6
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (7)
Products and version ranges known to be affected.
advisories (2)
Vendor and ecosystem advisories describing this.
- WID-SEC-W-2026-2933Splunk SOAR: Mehrere SchwachstellenDeutsch2026-08-19csaf · cert_bundDE
Ein Angreifer kann mehrere Schwachstellen in Splunk SOAR ausnutzen, um Sicherheitsvorkehrungen zu umgehen, um Informationen offenzulegen, um Dateien zu manipulieren, um einen SQL-Injection Angriff durchzuführen, um einen Cross-Site Scripting Angriff durchzuführen, und um beliebigen Programmcode auszuführen.
- GHSA-wfv2-pwc8-crg5jsPDF has HTML Injection in New Window paths2026-03-17ghsa · osvUS
### 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.
also known as (4)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (16)
External citations — patches, advisories, analysis.
- https://access.redhat.com/security/cve/cve-2026-31938cnnvd
- https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7cnnvd
- https://github.com/parallax/jsPDF/releasesPatchcnnvd
- https://github.com/parallax/jsPDF/releases/tag/v4.2.1cnnvd
- https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5cnnvd
- https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7enisa_euvd
- https://github.com/parallax/jsPDF/releases/tag/v4.2.1enisa_euvd
- https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5enisa_euvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan