CVE-2026-24043 Overview
CVE-2026-24043 is an XML injection vulnerability in jsPDF, a popular JavaScript library used to generate PDF documents. Prior to version 4.1.0, the addMetadata function fails to properly sanitize user-controlled input in its first argument, enabling attackers to inject arbitrary XML content into generated PDFs.
This vulnerability allows malicious users who can supply unsanitized input to the addMetadata method to inject arbitrary XMP (Extensible Metadata Platform) metadata into PDF documents. The integrity of any PDF generated through a vulnerable application can no longer be guaranteed, particularly impacting signed documents and PDFs that undergo downstream processing or storage.
Critical Impact
Attackers can inject arbitrary XMP metadata into generated PDFs, potentially compromising document integrity, invalidating digital signatures, and enabling document manipulation attacks.
Affected Products
- jsPDF versions prior to 4.1.0
Discovery Timeline
- 2026-02-02 - CVE CVE-2026-24043 published to NVD
- 2026-02-03 - Last updated in NVD database
Technical Details for CVE-2026-24043
Vulnerability Analysis
This vulnerability is classified under CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), commonly known as Injection. The root issue lies in the addMetadata function's failure to sanitize or validate the content passed as its first argument before embedding it into the PDF's XMP metadata stream.
XMP metadata in PDFs follows an XML-based structure. When user-controlled data is directly inserted into this XML structure without proper encoding or validation, attackers can break out of the intended data context and inject their own XML elements. This can lead to modification of document properties, injection of malicious metadata, or corruption of the XMP structure entirely.
The vulnerability is accessible over the network in web applications that expose PDF generation functionality to users, requiring no authentication or user interaction to exploit. While the vulnerability does not directly lead to data confidentiality breaches, it enables integrity violations in both the vulnerable system and potentially in subsequent systems that process the manipulated PDFs.
Root Cause
The addMetadata function in jsPDF versions prior to 4.1.0 directly concatenates user-supplied input into the XMP metadata XML structure without performing input validation, escaping XML special characters, or implementing proper output encoding. This missing input sanitization allows XML injection attacks where special characters like <, >, ", and & can be used to manipulate the XML structure.
Attack Vector
The attack is network-based and can be executed against any web application that:
- Uses a vulnerable version of jsPDF (prior to 4.1.0)
- Allows users to supply input that is passed to the addMetadata function
- Does not implement application-level sanitization of this input
An attacker would craft a malicious input string containing XML markup designed to inject additional XMP metadata elements or modify existing ones. When the PDF is generated, this injected content becomes part of the document's metadata. If the PDF is subsequently digitally signed, the manipulated metadata could affect the document's integrity verification. Similarly, systems that rely on PDF metadata for indexing, archival, or processing may be deceived by the injected content.
The vulnerability requires no special privileges or user interaction, making it straightforward to exploit in susceptible applications.
Detection Methods for CVE-2026-24043
Indicators of Compromise
- Unexpected or malformed XMP metadata structures within generated PDF documents
- PDF metadata containing XML special characters or unexpected XML elements
- Error logs indicating XML parsing failures when processing generated PDFs
- Unusual metadata content in PDFs that doesn't match expected application output
Detection Strategies
- Audit application code to identify all instances where user input flows to the addMetadata function
- Implement input validation checks that detect XML special characters in metadata inputs
- Use static application security testing (SAST) tools to identify injection vulnerabilities in JavaScript codebases
- Monitor PDF generation endpoints for inputs containing XML markup patterns
Monitoring Recommendations
- Log all inputs passed to PDF generation functions for forensic analysis
- Implement alerting for PDF metadata validation failures in downstream processing systems
- Monitor for unusual patterns in user-supplied metadata content
- Review generated PDFs periodically for metadata integrity anomalies
How to Mitigate CVE-2026-24043
Immediate Actions Required
- Upgrade jsPDF to version 4.1.0 or later immediately
- Audit all application code paths that use the addMetadata function
- Implement server-side input sanitization for any user-controlled data passed to PDF generation
- Review any PDFs generated by vulnerable versions that may have been stored or distributed
Patch Information
The vulnerability has been fixed in jsPDF version 4.1.0. The fix implements proper input sanitization for the addMetadata function to prevent XML injection attacks. Organizations should upgrade to this version or later to remediate the vulnerability.
For detailed information about the security fix, refer to the GitHub Commit Details and the GitHub Release v4.1.0. Additional information is available in the GitHub Security Advisory GHSA-vm32-vv63-w422.
Workarounds
- Implement strict input validation and XML entity encoding for all data passed to addMetadata before upgrading
- Sanitize user input by escaping XML special characters (<, >, ", ', &) before passing to the function
- Use an allowlist approach for metadata content, permitting only known-safe characters and patterns
- Consider disabling custom metadata functionality temporarily if upgrade is not immediately possible
# Example npm upgrade command
npm install jspdf@4.1.0
# Or using yarn
yarn upgrade jspdf@4.1.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


