# CVE-2026-31938: parallax jsPDF XSS in output function options

Source: https://junglewise.ai/threats/cve-2026-31938-parallax-jspdf-xss-in-output-function-options  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-03-18. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-31938 · Severity: critical · CVSS 9.6 · Published 2026-03-18

jsPDF is a popular JavaScript library used by web applications to generate PDF documents directly in the browser. A security flaw allows attackers to inject malicious code into the PDF generation process if the application uses unsanitized user input for certain settings. If a victim generates and opens a PDF under these conditions, the attacker's code could run in their browser, potentially leading to the theft of sensitive data, session hijacking, or unauthorized actions on the user's behalf.

Technologies: [jspdf (npm)](https://junglewise.ai/threats/technologies/jspdf), [Red Hat Advanced Cluster Security for Kubernetes](https://junglewise.ai/threats/technologies/advanced-cluster-security-for-kubernetes). Vendors: [npm](https://junglewise.ai/threats/vendors/npm), [Red Hat](https://junglewise.ai/threats/vendors/red-hat).

## Quick answers

**Is CVE-2026-31938 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-31938 being exploited in the wild.

**How severe is CVE-2026-31938?** Critical severity, with a CVSS score of 9.6, published 18 March 2026.

**Which products and versions are affected?** jspdf (npm) SEMVER:introduced=0,fixed=4.2.1.

**Is there a fix for CVE-2026-31938?** Yes. jspdf (npm): upgrade to 4.2.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-31938 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-31938?** Check whether you run jspdf (npm) or Red Hat Advanced Cluster Security for Kubernetes at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- jspdf (npm): upgrade to 4.2.1 or later

  ```sh
  npm install jspdf@4.2.1
  ```


## Technical details

A Cross-Site Scripting (XSS) vulnerability exists in jsPDF versions prior to 4.2.1 due to improper neutralization of the 'options' argument in the 'output' function. Specifically, when using method overloads such as 'pdfobjectnewwindow', 'pdfjsnewwindow', or 'dataurlnewwindow', parameters like 'pdfObjectUrl', 'pdfJsUrl', and 'filename' are included in generated HTML strings without sufficient sanitization. An attacker can provide a malicious payload (e.g., breaking out of an iframe or script tag) that executes arbitrary JavaScript in the victim's browser context when the PDF is rendered. This is a client-side vulnerability requiring user interaction (the victim must trigger the PDF generation/opening). The issue is fixed in version 4.2.1 by properly encoding these options.

## Affected products

- parallax jsPDF < 4.2.1
- Red Hat Red Hat Advanced Cluster Security for Kubernetes 4.8
- Red Hat Red Hat Advanced Cluster Security for Kubernetes 4.9

## Identifiers

- CVE-2026-31938
- GHSA-wfv2-pwc8-crg5

## Timeline

- 2026-03-17: patched: Fixes committed and version 4.2.1 released.
- 2026-03-17: advisory: GitHub Security Advisory GHSA-wfv2-pwc8-crg5 published.
- 2026-03-18: disclosed: CVE-2026-31938 published to NVD.

## References

- [https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7](https://github.com/parallax/jsPDF/commit/87a40bbd07e6b30575196370670b41f264aa78d7)
- [https://github.com/parallax/jsPDF/releases/tag/v4.2.1](https://github.com/parallax/jsPDF/releases/tag/v4.2.1)
- [https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5](https://github.com/parallax/jsPDF/security/advisories/GHSA-wfv2-pwc8-crg5)
- [https://access.redhat.com/errata/RHSA-2026:7110](https://access.redhat.com/errata/RHSA-2026:7110)
- [https://access.redhat.com/errata/RHSA-2026:7128](https://access.redhat.com/errata/RHSA-2026:7128)
- [https://access.redhat.com/security/cve/CVE-2026-31938](https://access.redhat.com/security/cve/CVE-2026-31938)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2448550](https://bugzilla.redhat.com/show_bug.cgi?id=2448550)

## Related threats

- [Red Hat Advanced Cluster Security for Kubernetes SAML replay attack](https://junglewise.ai/threats/cve-2026-103314-a-flaw-was-found-in-red-hat-advanced-cluster-security-for)
- [Red Hat Advanced Cluster Security privilege escalation in M2M auth](https://junglewise.ai/threats/cve-2026-19278-red-hat-advanced-cluster-security-privilege-escalation-in-m2m)
- [Red Hat Advanced Cluster Security policy bypass via label injection](https://junglewise.ai/threats/cve-2026-10079-red-hat-advanced-cluster-security-policy-bypass-via-label)
- [parallax jsPDF PDF object injection in createAnnotation](https://junglewise.ai/threats/cve-2026-31898-parallax-jspdf-pdf-object-injection-in-createannotation)
- [NaturalIntelligence fast-xml-parser XSS via regex injection in DOCTYPE](https://junglewise.ai/threats/cve-2026-25896-naturalintelligence-fast-xml-parser-xss-via-regex-injection-in)
