The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-22787

CVE-2026-22787: html2pdf.js XSS Vulnerability

CVE-2026-22787 is a cross-site scripting flaw in html2pdf.js that allows malicious scripts to execute in client browsers when processing unsanitized text. This article covers technical details, affected versions, and mitigation.

Published: January 23, 2026

CVE-2026-22787 Overview

CVE-2026-22787 is a Cross-Site Scripting (XSS) vulnerability in html2pdf.js, a popular client-side JavaScript library that converts webpages or HTML elements into printable PDF documents. Prior to version 0.14.0, html2pdf.js fails to sufficiently sanitize text input before attaching it to the DOM when processing text sources rather than HTML elements. This allows attackers to inject malicious scripts that execute in the context of the victim's browser session.

Critical Impact

This XSS vulnerability enables attackers to execute arbitrary JavaScript in victim browsers, potentially leading to session hijacking, credential theft, defacement, or malware distribution through applications using the vulnerable html2pdf.js library.

Affected Products

  • html2pdf.js versions prior to 0.14.0
  • Web applications integrating vulnerable html2pdf.js versions for client-side PDF generation

Discovery Timeline

  • January 14, 2026 - CVE-2026-22787 published to NVD
  • January 20, 2026 - Last updated in NVD database

Technical Details for CVE-2026-22787

Vulnerability Analysis

The vulnerability resides in how html2pdf.js handles text-based input sources. When developers pass a text string to the library for PDF conversion instead of a DOM element reference, the library fails to properly sanitize this input before inserting it into the Document Object Model (DOM). This creates an injection point where malicious JavaScript can be embedded within the text content.

The attack surface exists because the library's text handling pathway lacks the same security controls applied to element-based inputs. When the unsanitized text is attached to the DOM for rendering, any embedded script tags or event handlers execute immediately in the user's browser context.

This vulnerability is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation), commonly known as Cross-Site Scripting. Successful exploitation requires user interaction, as the victim must trigger the PDF generation functionality with attacker-controlled input.

Root Cause

The root cause is insufficient input sanitization in the text source processing pathway of html2pdf.js. When text content is passed to the library, it is directly inserted into the DOM without encoding HTML special characters or stripping potentially dangerous script elements. The fix implemented in version 0.14.0 adds proper sanitization to ensure text inputs are safely escaped before DOM insertion.

Attack Vector

The attack vector is network-based and requires user interaction. An attacker can exploit this vulnerability by crafting malicious input that gets processed by html2pdf.js as a text source. Attack scenarios include:

  1. Reflected XSS: User-supplied data passed directly to html2pdf.js text processing without server-side validation
  2. Stored XSS: Malicious payloads stored in databases that are later retrieved and processed by the vulnerable library
  3. DOM-based XSS: Client-side JavaScript that pulls attacker-controlled data into html2pdf.js text processing

The exploitation mechanism involves injecting script content within text that is subsequently rendered by the library. When html2pdf.js processes this malicious text and attaches it to the DOM, the embedded scripts execute with full access to the page context, cookies, and session data.

Technical details regarding the specific vulnerable code path and patch implementation can be found in the GitHub Security Advisory and the associated commit.

Detection Methods for CVE-2026-22787

Indicators of Compromise

  • Unusual JavaScript execution patterns originating from PDF generation functionality
  • Client-side errors or warnings related to html2pdf.js processing unexpected content
  • Reports of unexpected browser behavior when users interact with PDF export features
  • Evidence of data exfiltration attempts to unknown domains triggered during PDF generation

Detection Strategies

  • Implement Content Security Policy (CSP) headers to detect and block inline script execution attempts
  • Monitor web application logs for suspicious input patterns targeting PDF generation endpoints
  • Conduct software composition analysis (SCA) scans to identify applications using html2pdf.js versions prior to 0.14.0
  • Deploy browser-based XSS detection tools that can identify DOM manipulation anomalies

Monitoring Recommendations

  • Enable CSP violation reporting to capture attempted XSS exploitation in production environments
  • Monitor client-side error tracking systems for html2pdf.js-related exceptions
  • Review application dependency manifests regularly to ensure html2pdf.js is updated to 0.14.0 or later
  • Implement runtime application self-protection (RASP) to detect malicious script injection attempts

How to Mitigate CVE-2026-22787

Immediate Actions Required

  • Upgrade html2pdf.js to version 0.14.0 or later immediately across all affected applications
  • Audit all code paths that pass user-controlled data to html2pdf.js text processing functions
  • Implement server-side input validation and sanitization as a defense-in-depth measure
  • Deploy Content Security Policy headers to mitigate XSS impact if immediate patching is not possible

Patch Information

The vulnerability has been fixed in html2pdf.js version 0.14.0. The patch implements proper input sanitization for text sources before DOM attachment, preventing script injection. Organizations should update their dependencies using their package manager:

  • npm: npm update html2pdf.js or npm install html2pdf.js@0.14.0
  • yarn: yarn upgrade html2pdf.js@0.14.0

For detailed information about the fix, refer to the GitHub Release v0.14.0 and the Pull Request #877.

Workarounds

  • If immediate upgrade is not possible, sanitize all user input before passing it to html2pdf.js using a trusted HTML sanitization library such as DOMPurify
  • Restrict html2pdf.js to only accept DOM element references rather than text strings where possible
  • Implement strict Content Security Policy headers with script-src directives to prevent inline script execution
  • Consider server-side PDF generation as an alternative to client-side processing for sensitive applications
bash
# Update html2pdf.js to patched version
npm install html2pdf.js@0.14.0 --save

# Verify installed version
npm list html2pdf.js

# Alternative: Add to package.json with minimum version constraint
# "html2pdf.js": ">=0.14.0"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechHtml2pdf.js

  • SeverityHIGH

  • CVSS Score8.7

  • EPSS Probability0.07%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityLow
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Commit Reference

  • GitHub Issue Discussion

  • GitHub Pull Request

  • GitHub Release v0.14.0

  • GitHub Security Advisory GHSA-w8x4-x68c-m6fc

  • Aydinnyunus CVE-2026-22787 Analysis
  • Latest CVEs
  • CVE-2026-35467: Browser API Key Information Disclosure

  • CVE-2026-35466: cveInterface.js XSS Vulnerability

  • CVE-2026-30252: ZenShare Suite XSS Vulnerability

  • CVE-2026-30251: ZenShare Suite v17.0 XSS Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English