Description

A critical security vulnerability has been discovered in jsPDF, a widely used JavaScript library for generating PDF documents. The flaw, assigned a CVSS score of 9.2 and tracked as CVE-2025-68428, affects Node.js environments and allows attackers to read arbitrary files from the server’s local file system. This Local File Inclusion and path traversal issue can lead to serious information disclosure if exploited in applications that process untrusted input. The vulnerability exists in the Node.js builds of jsPDF, specifically in how the library handles file paths passed to functions such as loadFile, addImage, addFont, and html. These methods accept file paths without proper sanitization, enabling attackers to supply crafted paths that point to sensitive local files instead of legitimate resources. When this occurs, jsPDF reads the targeted file and embeds its contents directly into the generated PDF, potentially exposing confidential data such as configuration files, application secrets, or credentials. The issue has been fixed in jsPDF version 4.0.0, which introduces default restrictions on file system access in Node.js environments. Users are strongly advised to upgrade to this version as soon as possible to mitigate the risk. For those unable to update immediately, temporary safeguards include sanitizing all user-controlled file paths before passing them to jsPDF and, for modern Node.js versions, enforcing file system access controls using runtime permission flags. These measures can help reduce exposure until the official patch is applied.