GHSA-W8X4-X68C-M6FC
Vulnerability from github – Published: 2026-01-14 16:53 – Updated: 2026-01-14 19:50
VLAI?
Summary
html2pdf.js contains a cross-site scripting vulnerability
Details
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:
import html2pdf from 'html2pdf.js/src/index.js';
const maliciousHTML = '<img src=x onerror="alert(document.cookie)">';
html2pdf(maliciousHTML);
// or html2pdf().from(maliciousHTML);
Patches
This vulnerability has been fixed in html2pdf.js@0.14.0 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
- Initial report: https://github.com/eKoopmans/html2pdf.js/issues/865
- Fix: https://github.com/eKoopmans/html2pdf.js/pull/877, v0.14.0
- CVE-2026-22787: https://nvd.nist.gov/vuln/detail/CVE-2026-22787
Severity ?
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "html2pdf.js"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.14.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-22787"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2026-01-14T16:53:10Z",
"nvd_published_at": "2026-01-14T17:16:09Z",
"severity": "HIGH"
},
"details": "### Impact\nhtml2pdf.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\u0027s data.\n\nExample attack vector:\n\n```js\nimport html2pdf from \u0027html2pdf.js/src/index.js\u0027;\n\nconst maliciousHTML = \u0027\u003cimg src=x onerror=\"alert(document.cookie)\"\u003e\u0027;\nhtml2pdf(maliciousHTML);\n// or html2pdf().from(maliciousHTML);\n```\n\n### Patches\nThis vulnerability has been fixed in html2pdf.js@0.14.0 to sanitize text sources using DOMPurify. There are no other breaking changes in this version.\n\n### Workarounds\nUsers of earlier versions of html2pdf.js must safely sanitize any text before using it as a source in html2pdf.js.\n\n### References\n- Initial report: https://github.com/eKoopmans/html2pdf.js/issues/865\n- Fix: https://github.com/eKoopmans/html2pdf.js/pull/877, [v0.14.0](https://github.com/eKoopmans/html2pdf.js/releases/tag/v0.14.0)\n- CVE-2026-22787: https://nvd.nist.gov/vuln/detail/CVE-2026-22787",
"id": "GHSA-w8x4-x68c-m6fc",
"modified": "2026-01-14T19:50:44Z",
"published": "2026-01-14T16:53:10Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/eKoopmans/html2pdf.js/security/advisories/GHSA-w8x4-x68c-m6fc"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-22787"
},
{
"type": "WEB",
"url": "https://github.com/eKoopmans/html2pdf.js/issues/865"
},
{
"type": "WEB",
"url": "https://github.com/eKoopmans/html2pdf.js/pull/877"
},
{
"type": "WEB",
"url": "https://github.com/eKoopmans/html2pdf.js/commit/988826e336035b39a8608182d7b73c0e3cd78c7b"
},
{
"type": "PACKAGE",
"url": "https://github.com/eKoopmans/html2pdf.js"
},
{
"type": "WEB",
"url": "https://github.com/eKoopmans/html2pdf.js/releases/tag/v0.14.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "html2pdf.js contains a cross-site scripting vulnerability"
}
Loading…
Loading…
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
Loading…