CVE-2026-25755

8.1 HIGH

📋 TL;DR

This vulnerability in jsPDF allows attackers to inject arbitrary PDF objects into generated documents by controlling the argument of the `addJS` method. By escaping JavaScript string delimiters, attackers can execute malicious actions or alter document structure, affecting any user who opens the generated PDF. This impacts any application using vulnerable versions of jsPDF to generate PDFs from user-controlled input.

💻 Affected Systems

Products:
  • jsPDF
Versions: All versions prior to 4.2.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that use the `addJS` method with user-controlled input. Applications that don't use this method or properly sanitize input are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of PDF viewer application, arbitrary code execution on user's system when opening malicious PDF, data exfiltration, or system takeover.

🟠

Likely Case

PDF document manipulation, injection of malicious content, potential cross-site scripting (XSS) in PDF viewers, or denial of service through malformed PDFs.

🟢

If Mitigated

Limited impact with proper input validation and escaping, potentially only minor document formatting issues.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user interaction to open the malicious PDF. The vulnerability is well-documented with public references and proof-of-concept details available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.2.0

Vendor Advisory: https://github.com/parallax/jsPDF/security/advisories/GHSA-9vjf-qc39-jprp

Restart Required: No

Instructions:

1. Update jsPDF to version 4.2.0 or later. 2. Run `npm update jspdf` or equivalent package manager command. 3. Test PDF generation functionality to ensure compatibility.

🔧 Temporary Workarounds

Input sanitization workaround

all

Escape parentheses in user-provided JavaScript code before passing to the `addJS` method

// Before passing user input to addJS:
const sanitizedInput = userInput.replace(/\(/g, '\\(').replace(/\)/g, '\\)');

🧯 If You Can't Patch

  • Disable or restrict use of the `addJS` method in applications
  • Implement strict input validation and sanitization for all user-provided content passed to PDF generation functions

🔍 How to Verify

Check if Vulnerable:

Check package.json or node_modules for jsPDF version. If version is <4.2.0 and application uses `addJS` method with user input, it's vulnerable.

Check Version:

npm list jspdf

Verify Fix Applied:

Verify jsPDF version is 4.2.0 or later. Test PDF generation with malicious input to ensure injection is prevented.

📡 Detection & Monitoring

Log Indicators:

  • Unusual PDF generation patterns
  • Multiple failed PDF generation attempts
  • Large or malformed JavaScript strings in PDF generation logs

Network Indicators:

  • Unexpected PDF downloads containing JavaScript
  • PDF files with embedded JavaScript from untrusted sources

SIEM Query:

source="application_logs" AND ("addJS" OR "jspdf") AND ("error" OR "malformed" OR "injection")

🔗 References

📤 Share & Export