html2pdf.js contains a cross-site scripting vulnerability
High severity
GitHub Reviewed
Published
Jan 14, 2026
in
eKoopmans/html2pdf.js
•
Updated Jan 14, 2026
Description
Published to the GitHub Advisory Database
Jan 14, 2026
Reviewed
Jan 14, 2026
Published by the National Vulnerability Database
Jan 14, 2026
Last updated
Jan 14, 2026
Impact
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.
Example attack vector:
Patches
This vulnerability has been fixed in [email protected] to sanitize text sources using DOMPurify. There are no other breaking changes in this version.
Workarounds
Users of earlier versions of html2pdf.js must safely sanitize any text before using it as a source in html2pdf.js.
References
References