Executive brief
jsPDF is a popular JavaScript library used to generate PDF documents. In versions prior to 4.0.0, a security flaw in the Node.js version of the library allows attackers to access sensitive files on the server's local file system. By providing a malicious file path, an attacker can force the application to include private system files or data directly into a generated PDF, leading to significant data exposure.
Technical details
A path traversal vulnerability exists in the Node.js builds of jsPDF (dist/jspdf.node.js and dist/jspdf.node.min.js) due to insufficient sanitization of the first argument in the loadFile method. This flaw also extends to the addImage, html, and addFont methods. An attacker who can influence the file path passed to these methods can retrieve arbitrary files from the local file system where the Node process is running. The contents of these files are then embedded verbatim into the resulting PDF document. The vulnerability is resolved in version 4.0.0, which implements default restrictions on file system access. Users can also mitigate this by using Node.js's native --permission flags or manually sanitizing input paths.
Affected products
- parallax jsPDF < 4.0.0
Timeline
- 2025-12-18: patched: Fix committed to repository
- 2026-01-03: advisory: GitHub Security Advisory published
- 2026-01-05: disclosed: CVE published to NVD
References
- https://github.com/parallax/jsPDF/commit/a688c8f479929b24a6543b1fa2d6364abb03066d
- https://github.com/parallax/jsPDF/releases/tag/v4.0.0
- https://github.com/parallax/jsPDF/security/advisories/GHSA-f8cm-6447-x5h2
- https://access.redhat.com/errata/RHSA-2026:1517
- https://access.redhat.com/errata/RHSA-2026:2350
- https://access.redhat.com/errata/RHSA-2026:2568
- https://access.redhat.com/security/cve/CVE-2025-68428