CVE-2026-25755: CWE-94: Improper Control of Generation of Code ('Code Injection') in parallax jsPDF
jsPDF is a library to generate PDFs in JavaScript. Prior to 4.2.0, user control of the argument of the `addJS` method allows an attacker to inject arbitrary PDF objects into the generated document. By crafting a payload that escapes the JavaScript string delimiter, an attacker can execute malicious actions or alter the document structure, impacting any user who opens the generated PDF. The vulnerability has been fixed in [email protected]. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the `addJS` method.
AI Analysis
Technical Summary
The jsPDF library's addJS method prior to version 4.2.0 improperly controls the generation of code by accepting user input without adequate sanitization. This flaw allows attackers to craft payloads that escape JavaScript string delimiters, injecting arbitrary PDF objects and enabling execution of malicious JavaScript code embedded in the PDF. Exploitation requires an attacker to supply a crafted payload to the addJS method and convince a user to open the malicious PDF in a compatible viewer. The vulnerability is tracked as CVE-2026-25755 and classified under CWE-94 (Improper Control of Generation of Code). The issue was fixed in jsPDF version 4.2.0, and a mitigation involves escaping backslashes and parentheses in user-provided JavaScript code before passing it to addJS.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary JavaScript code within the context of the PDF viewer when a user opens a maliciously crafted PDF document. This can lead to unauthorized actions or alteration of the document structure, impacting confidentiality and integrity. The vulnerability does not affect the application using jsPDF directly but poses a risk to end users who open the generated PDFs. The CVSS v3.1 base score is 8.1 (high severity), reflecting network attack vector, low complexity, no privileges required, user interaction required, and high impact on confidentiality and integrity.
Mitigation Recommendations
A fix is available in jsPDF version 4.2.0; users should upgrade to this version to remediate the vulnerability. As a workaround, sanitize user-provided JavaScript code by strictly escaping backslashes and parentheses before passing it to the addJS method. Additionally, users should avoid opening PDF documents from untrusted sources. The vendor advisory confirms the availability of an official fix and recommends these mitigations.
CVE-2026-25755: CWE-94: Improper Control of Generation of Code ('Code Injection') in parallax jsPDF
Description
jsPDF is a library to generate PDFs in JavaScript. Prior to 4.2.0, user control of the argument of the `addJS` method allows an attacker to inject arbitrary PDF objects into the generated document. By crafting a payload that escapes the JavaScript string delimiter, an attacker can execute malicious actions or alter the document structure, impacting any user who opens the generated PDF. The vulnerability has been fixed in [email protected]. As a workaround, escape parentheses in user-provided JavaScript code before passing them to the `addJS` method.
CVSS v3.1
Score 8.1high
Affected software
parallax
jsPDF
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The jsPDF library's addJS method prior to version 4.2.0 improperly controls the generation of code by accepting user input without adequate sanitization. This flaw allows attackers to craft payloads that escape JavaScript string delimiters, injecting arbitrary PDF objects and enabling execution of malicious JavaScript code embedded in the PDF. Exploitation requires an attacker to supply a crafted payload to the addJS method and convince a user to open the malicious PDF in a compatible viewer. The vulnerability is tracked as CVE-2026-25755 and classified under CWE-94 (Improper Control of Generation of Code). The issue was fixed in jsPDF version 4.2.0, and a mitigation involves escaping backslashes and parentheses in user-provided JavaScript code before passing it to addJS.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary JavaScript code within the context of the PDF viewer when a user opens a maliciously crafted PDF document. This can lead to unauthorized actions or alteration of the document structure, impacting confidentiality and integrity. The vulnerability does not affect the application using jsPDF directly but poses a risk to end users who open the generated PDFs. The CVSS v3.1 base score is 8.1 (high severity), reflecting network attack vector, low complexity, no privileges required, user interaction required, and high impact on confidentiality and integrity.
Mitigation Recommendations
A fix is available in jsPDF version 4.2.0; users should upgrade to this version to remediate the vulnerability. As a workaround, sanitize user-provided JavaScript code by strictly escaping backslashes and parentheses before passing it to the addJS method. Additionally, users should avoid opening PDF documents from untrusted sources. The vendor advisory confirms the availability of an official fix and recommends these mitigations.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-05T18:35:52.357Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-25755","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:7110","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:7128","vendor":"Red Hat"}]
Threat ID: 6997264f5215391843713250
Added to database: 02/19/2026, 15:03:43 UTC
Last enriched: 08/17/2026, 13:14:16 UTC
Last updated: 09/10/2026, 19:46:22 UTC
Views: 864
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.