CVE-2026-22787: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in eKoopmans html2pdf.js
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 html2pdf.js@0.14.0.
AI Analysis
Technical Summary
html2pdf.js is a client-side JavaScript library that converts webpages or HTML elements into printable PDFs. Prior to version 0.14.0, the library contained a critical cross-site scripting (XSS) vulnerability identified as CVE-2026-22787 (CWE-79). This vulnerability occurs when html2pdf.js is used with a text source input rather than a DOM element. The library fails to properly neutralize or sanitize this text input before attaching it to the DOM, allowing malicious scripts embedded in the text to execute in the user's browser context. This improper input handling can lead to the execution of arbitrary JavaScript code, enabling attackers to steal sensitive information, manipulate page content, or disrupt availability. The vulnerability is exploitable remotely without authentication but requires user interaction (e.g., visiting a maliciously crafted page). The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N) reflects a network attack vector with low complexity, no privileges required, and high impact on confidentiality and integrity. Although no public exploits are currently known, the vulnerability poses a significant threat to any web application embedding vulnerable versions of html2pdf.js. The issue was addressed and fixed in version 0.14.0 by improving input sanitization and neutralization mechanisms. Organizations relying on this library should upgrade promptly to prevent exploitation.
Potential Impact
For European organizations, exploitation of this XSS vulnerability could lead to unauthorized disclosure of sensitive data, session hijacking, defacement of web content, or injection of malicious payloads affecting users and internal systems. This is particularly critical for sectors handling personal data under GDPR, such as finance, healthcare, and e-commerce, where confidentiality breaches can result in regulatory penalties and reputational damage. The vulnerability can be leveraged to target employees or customers via phishing or malicious web pages, potentially enabling further lateral movement or credential theft. The client-side nature means that end users' browsers are directly impacted, increasing the risk of widespread compromise if the vulnerable library is embedded in popular web applications or portals. Given the high CVSS score and ease of exploitation, organizations face a substantial risk to data integrity and availability of services. The lack of known exploits in the wild suggests a window of opportunity for proactive mitigation before active attacks emerge.
Mitigation Recommendations
1. Immediately upgrade all instances of html2pdf.js to version 0.14.0 or later to ensure the vulnerability is patched. 2. Conduct an inventory of web applications and services to identify usage of html2pdf.js, especially those accepting user-generated text inputs. 3. Implement Content Security Policy (CSP) headers to restrict script execution and reduce the impact of potential XSS attacks. 4. Sanitize and validate all user inputs at the application level before passing them to client-side libraries, employing robust libraries or frameworks for input validation. 5. Educate developers on secure usage of third-party libraries and the risks of injecting unsanitized text into the DOM. 6. Monitor web application logs and user reports for suspicious activity indicative of XSS exploitation attempts. 7. Employ runtime application self-protection (RASP) or web application firewalls (WAF) with XSS detection capabilities as an additional layer of defense. 8. Review and update incident response plans to include scenarios involving client-side script injection attacks.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland
CVE-2026-22787: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in eKoopmans html2pdf.js
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 html2pdf.js@0.14.0.
AI-Powered Analysis
Technical Analysis
html2pdf.js is a client-side JavaScript library that converts webpages or HTML elements into printable PDFs. Prior to version 0.14.0, the library contained a critical cross-site scripting (XSS) vulnerability identified as CVE-2026-22787 (CWE-79). This vulnerability occurs when html2pdf.js is used with a text source input rather than a DOM element. The library fails to properly neutralize or sanitize this text input before attaching it to the DOM, allowing malicious scripts embedded in the text to execute in the user's browser context. This improper input handling can lead to the execution of arbitrary JavaScript code, enabling attackers to steal sensitive information, manipulate page content, or disrupt availability. The vulnerability is exploitable remotely without authentication but requires user interaction (e.g., visiting a maliciously crafted page). The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N) reflects a network attack vector with low complexity, no privileges required, and high impact on confidentiality and integrity. Although no public exploits are currently known, the vulnerability poses a significant threat to any web application embedding vulnerable versions of html2pdf.js. The issue was addressed and fixed in version 0.14.0 by improving input sanitization and neutralization mechanisms. Organizations relying on this library should upgrade promptly to prevent exploitation.
Potential Impact
For European organizations, exploitation of this XSS vulnerability could lead to unauthorized disclosure of sensitive data, session hijacking, defacement of web content, or injection of malicious payloads affecting users and internal systems. This is particularly critical for sectors handling personal data under GDPR, such as finance, healthcare, and e-commerce, where confidentiality breaches can result in regulatory penalties and reputational damage. The vulnerability can be leveraged to target employees or customers via phishing or malicious web pages, potentially enabling further lateral movement or credential theft. The client-side nature means that end users' browsers are directly impacted, increasing the risk of widespread compromise if the vulnerable library is embedded in popular web applications or portals. Given the high CVSS score and ease of exploitation, organizations face a substantial risk to data integrity and availability of services. The lack of known exploits in the wild suggests a window of opportunity for proactive mitigation before active attacks emerge.
Mitigation Recommendations
1. Immediately upgrade all instances of html2pdf.js to version 0.14.0 or later to ensure the vulnerability is patched. 2. Conduct an inventory of web applications and services to identify usage of html2pdf.js, especially those accepting user-generated text inputs. 3. Implement Content Security Policy (CSP) headers to restrict script execution and reduce the impact of potential XSS attacks. 4. Sanitize and validate all user inputs at the application level before passing them to client-side libraries, employing robust libraries or frameworks for input validation. 5. Educate developers on secure usage of third-party libraries and the risks of injecting unsanitized text into the DOM. 6. Monitor web application logs and user reports for suspicious activity indicative of XSS exploitation attempts. 7. Employ runtime application self-protection (RASP) or web application firewalls (WAF) with XSS detection capabilities as an additional layer of defense. 8. Review and update incident response plans to include scenarios involving client-side script injection attacks.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-01-09T18:27:19.388Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6967e9c5f809b25a98cd9f49
Added to database: 1/14/2026, 7:08:53 PM
Last enriched: 1/21/2026, 7:38:38 PM
Last updated: 2/6/2026, 6:15:49 AM
Views: 29
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-0598: Unverified Ownership in Red Hat Red Hat Ansible Automation Platform 2
MediumCVE-2026-1991: NULL Pointer Dereference in libuvc
MediumCVE-2026-1990: NULL Pointer Dereference in oatpp
MediumCVE-2026-1979: Use After Free in mruby
MediumCVE-2026-1978: Direct Request in kalyan02 NanoCMS
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.