CVE-2026-22787 Details
Description
html2pdf.js converts any webpage or element into a printable PDF entirely client-side. Prior to 0.14.0, html2pdf.js contains a cross-site scripting (XSS) vulnerability when given a text source rather than an element. This text is not sufficiently sanitized before being attached to the DOM, allowing malicious scripts to be run on the client browser and risking the confidentiality, integrity, and availability of the page's data. This vulnerability has been fixed in [email protected].
A cross-site scripting (XSS) vulnerability has been identified in html2pdf.js versions prior to 0.14.0. The issue arises when the library is given a text source instead of an element, as the text is not properly sanitized before being added to the DOM. This oversight allows malicious scripts to execute in the client's browser, potentially leading to session hijacking, data theft, and unauthorized actions. The vulnerability has been fixed in version 0.14.0 by sanitizing text sources with DOMPurify.
Users should update to html2pdf.js version 0.14.0 or later, and ensure that any text sources are properly sanitized before use.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Jan 14, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://aydinnyunus.github.io/2026/01/17/cve-2026-22787-html2pdf-xss-vulnerability/ | CVE | ExploitMitigationThird Party Advisory |
| https://github.com/eKoopmans/html2pdf.js/commit/988826e336035b39a8608182d7b73c0e3cd78c7b | [email protected] | Patch |
| https://github.com/eKoopmans/html2pdf.js/issues/865 | [email protected] | Issue Tracking |
| https://github.com/eKoopmans/html2pdf.js/pull/877 | [email protected] | Issue TrackingPatch |
| https://github.com/eKoopmans/html2pdf.js/releases/tag/v0.14.0 | [email protected] | Release Notes |
| https://github.com/eKoopmans/html2pdf.js/security/advisories/GHSA-w8x4-x68c-m6fc | [email protected] | PatchVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| ekoopmans html2pdf.js | < 0.14.0 |
CPE
Remediation
| |
Change History
5 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Mar 12, 2026 | Initial Analysis | [email protected] |
| Jan 20, 2026 | CVE Modified | CVE |
| Jan 14, 2026 | New CVE Received | [email protected] |