# CVE-2026-22787: html2pdf.js has a cross-site scripting vulnerability

- Severity: High 8.7 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.39%, higher than 35% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-01-14T16:52:38.372Z
- Modified: 2026-06-17T10:20:25.633Z
- Also known as: GHSA-w8x4-x68c-m6fc
- Weaknesses: CWE-79
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- eKoopmans html2pdf.js: < 0.14.0; before 0.14.0
- html2pdf.js (npm): before 0.14.0

## Every score

- GitHub_M: CVSS:4.0 8.7 High `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`
- GitHub: CVSS:4.0 High `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`
- NVD: CVSS:3.1 6.1 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`

## References

- <https://aydinnyunus.github.io/2026/01/17/cve-2026-22787-html2pdf-xss-vulnerability/> (exploit, mitigation, third-party-advisory)
- <https://github.com/eKoopmans/html2pdf.js/security/advisories/GHSA-w8x4-x68c-m6fc> (patch, vendor-advisory, web)
- <https://github.com/eKoopmans/html2pdf.js/issues/865> (issue-tracking, web)
- <https://github.com/eKoopmans/html2pdf.js/pull/877> (issue-tracking, patch, web)
- <https://github.com/eKoopmans/html2pdf.js/commit/988826e336035b39a8608182d7b73c0e3cd78c7b> (patch, web)
- <https://github.com/eKoopmans/html2pdf.js/releases/tag/v0.14.0> (release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-22787> (advisory)
- <https://aydinnyunus.github.io/2026/01/17/cve-2026-22787-html2pdf-xss-vulnerability> (web)
- <https://github.com/eKoopmans/html2pdf.js> (package)

## Sources

- CVE List: [CVE-2026-22787](https://www.cve.org/CVERecord?id=CVE-2026-22787), CVE Terms of Use, modified 2026-01-20
- GitHub Advisory Database: [GHSA-w8x4-x68c-m6fc](https://github.com/advisories/GHSA-w8x4-x68c-m6fc), CC-BY-4.0, modified 2026-02-03
- NVD: [CVE-2026-22787](https://nvd.nist.gov/vuln/detail/CVE-2026-22787), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-22787 · Whole record: https://cve.day/CVE-2026-22787.json · Rebuilt by cve.day 2026-11-25T22:59:12.832Z
