CVE-2026-24043
📋 TL;DR
This vulnerability in jsPDF allows attackers to inject arbitrary XML metadata into generated PDFs by controlling the first argument of the addMetadata function. This compromises PDF integrity, particularly affecting signed documents. Applications using jsPDF versions before 4.1.0 that allow user input to the addMetadata method are vulnerable.
💻 Affected Systems
- jsPDF
⚠️ Risk & Real-World Impact
Worst Case
Compromised PDF integrity leads to invalidated digital signatures, enabling document tampering, fraud, or bypassing document validation systems that rely on PDF signatures.
Likely Case
Injection of malicious metadata that could trigger parsing issues in downstream PDF processors or cause unexpected behavior in applications that read PDF metadata.
If Mitigated
Limited impact if input validation prevents user control of addMetadata arguments or if PDFs are not signed or processed after generation.
🎯 Exploit Status
Exploitation requires user input to reach the vulnerable addMetadata function, which depends on application implementation.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 4.1.0
Vendor Advisory: https://github.com/parallax/jsPDF/security/advisories/GHSA-vm32-vv63-w422
Restart Required: No
Instructions:
1. Update jsPDF dependency to version 4.1.0 or later. 2. For npm: 'npm update jspdf'. 3. For yarn: 'yarn upgrade jspdf'. 4. Verify the update in package.json.
🔧 Temporary Workarounds
Input Sanitization
allImplement strict input validation and sanitization for any user-provided data passed to the addMetadata method.
Avoid User-Controlled Metadata
allDo not allow user input to control the first argument of addMetadata; use hardcoded or server-controlled values instead.
🧯 If You Can't Patch
- Implement strict input validation to reject or sanitize XML special characters in user input before passing to addMetadata.
- Disable or restrict the addMetadata functionality if not essential for your application.
🔍 How to Verify
Check if Vulnerable:
Check package.json or node_modules/jspdf/package.json for version number. If version is less than 4.1.0, the system is vulnerable if using addMetadata with user input.
Check Version:
npm list jspdf | grep jspdf
Verify Fix Applied:
Confirm jsPDF version is 4.1.0 or higher in package.json and test that user input to addMetadata no longer allows XML injection.
📡 Detection & Monitoring
Log Indicators:
- Unusual PDF generation errors, unexpected XML parsing in PDF metadata, or anomalies in PDF signature validation logs.
Network Indicators:
- Increased PDF generation requests with unusual parameters, particularly to endpoints that generate PDFs with metadata.
SIEM Query:
Search for application logs containing 'addMetadata' with user-provided parameters or PDF generation errors related to XML parsing.