A Leader in the 2026 Gartner® Magic Quadrant™ for Endpoint Protection. Six years running.Six years. Gartner® Magic Quadrant™ Leader.Find Out Why
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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-40296

CVE-2026-40296: PhpSpreadsheet XSS Vulnerability

CVE-2026-40296 is a stored XSS vulnerability in PhpSpreadsheet's HTML writer that bypasses escaping via custom number formats. This post covers technical details, affected versions, impact, and mitigation steps.

Published: May 7, 2026

CVE-2026-40296 Overview

CVE-2026-40296 is a stored cross-site scripting (XSS) vulnerability in PhpSpreadsheet, a pure PHP library for reading and writing spreadsheet files. The HTML writer skips htmlspecialchars escaping when a cell's formatted value differs from its original value. Attackers who control both the cell value and the cell number format in an uploaded spreadsheet can inject malicious HTML or JavaScript. When the spreadsheet is later converted to HTML and rendered for other users, the payload executes in their browsers. The issue is fixed in versions 5.7.0, 3.10.5, 2.4.5, 2.1.16, and 1.30.4.

Critical Impact

Authenticated attackers can deliver stored XSS to any user who views an HTML-rendered spreadsheet, enabling session theft, account takeover, and arbitrary actions in the victim's browser context.

Affected Products

  • PhpSpreadsheet versions prior to 5.7.0 on the 5.x branch
  • PhpSpreadsheet versions prior to 3.10.5, 2.4.5, and 2.1.16 on the 3.x and 2.x branches
  • PhpSpreadsheet versions prior to 1.30.4 on the 1.x branch

Discovery Timeline

  • 2026-05-06 - CVE-2026-40296 published to NVD
  • 2026-05-06 - Last updated in NVD database

Technical Details for CVE-2026-40296

Vulnerability Analysis

The vulnerability is classified as Cross-Site Scripting [CWE-79]. PhpSpreadsheet's HTML writer renders cell content into HTML output. When the writer detects that a cell's formatted value matches its original value, it applies htmlspecialchars to neutralize HTML metacharacters. When the formatted value differs from the original value, the writer assumes the formatter has already produced safe output and emits the formatted string directly.

This assumption breaks for number formats containing the text placeholder @ combined with literal characters. Formats such as ". @", "@ ", or "x@" instruct the formatter to substitute the cell value for @ and append the surrounding literals. The resulting formatted string differs from the original cell value, so escaping is bypassed and any HTML or script tags in the cell value reach the rendered page unchanged.

Root Cause

The root cause is an unsafe trust boundary in the HTML writer's escaping logic. Output sanitization is conditional on value equality rather than always applied. Any formatter transformation, including benign ones like literal concatenation, disables escaping. The writer treats formatter output as a sanitized string when it is in fact attacker-controllable user data.

Attack Vector

Exploitation requires an attacker who can supply both a cell value and a number format on a spreadsheet that the application later converts to HTML for other users. The attacker sets the cell value to an XSS payload such as a <script> or <img onerror=...> tag. The attacker assigns a number format that contains @ plus at least one literal character, forcing the formatted output to differ from the raw value. When a victim views the rendered HTML, the payload executes in the victim's session context.

The vulnerability requires user interaction and low privileges, and the scope changes because the injected script runs in the rendering application's origin rather than the uploader's. See the GitHub Security Advisory for the maintainer's technical write-up.

Detection Methods for CVE-2026-40296

Indicators of Compromise

  • Spreadsheet files containing cells whose number format strings include @ followed by or preceded by literal characters such as . @, @ , or x@.
  • Cell values containing HTML tag fragments such as <script, onerror=, onload=, javascript:, or <img inside uploaded XLSX, ODS, or XLS files.
  • HTML output produced by PhpSpreadsheet that contains unescaped < or > characters originating from spreadsheet cell content.

Detection Strategies

  • Audit application logs for spreadsheet uploads followed by HTML conversion calls, and inspect the rendered output for raw HTML markup that should have been escaped.
  • Statically scan uploaded spreadsheets to flag cells where the number format token list contains @ combined with non-@ literal characters.
  • Review web server response bodies for unescaped script-like content within elements emitted by PhpSpreadsheet's HTML writer.

Monitoring Recommendations

  • Monitor for browser-side Content Security Policy (CSP) violations on pages that render spreadsheet content.
  • Track outbound requests from rendered spreadsheet pages to unexpected domains, indicating data exfiltration via injected script.
  • Alert on PhpSpreadsheet library versions in production deployments that are below the fixed releases listed in the advisory.

How to Mitigate CVE-2026-40296

Immediate Actions Required

  • Upgrade PhpSpreadsheet to 5.7.0, 3.10.5, 2.4.5, 2.1.16, or 1.30.4 depending on the branch in use.
  • Inventory all applications using PhpSpreadsheet and confirm the installed version through composer show phpoffice/phpspreadsheet.
  • Apply a strict Content Security Policy that disallows inline scripts on pages rendering converted spreadsheet content.

Patch Information

The maintainers fixed the issue in PhpSpreadsheet versions 5.7.0, 3.10.5, 2.4.5, 2.1.16, and 1.30.4. The fix ensures htmlspecialchars escaping is applied to cell content regardless of whether the formatted value differs from the original value. Patch details are available in the GitHub Security Advisory GHSA-hrmw-qprp-wgmc.

Workarounds

  • Strip or normalize cell number formats in uploaded spreadsheets before invoking the HTML writer, removing any format containing the @ text placeholder.
  • Post-process HTML writer output through a server-side HTML sanitizer such as HTML Purifier before serving it to users.
  • Restrict spreadsheet upload privileges to trusted users until upgrading to a fixed version.
bash
# Upgrade to a patched PhpSpreadsheet release via Composer
composer require phpoffice/phpspreadsheet:^5.7.0

# Verify installed version
composer show phpoffice/phpspreadsheet | grep versions

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechPhpoffice Phpspreadsheet

  • SeverityMEDIUM

  • CVSS Score5.4

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-40902: PhpOffice PhpSpreadsheet DoS Vulnerability

  • CVE-2026-40863: PhpSpreadsheet XML Reader DoS Vulnerability

  • CVE-2024-45293: PHPSpreadsheet XXE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today 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