CVE-2024-56410: PhpSpreadsheet Cross-Site Scripting (XSS) Vulnerability in Custom Properties

phpoffice/phpspreadsheet Updated 02 Oct 2025

Summary

03/01/2025
Yes i
Moderate
5.4

CVE-2024-56410: PhpSpreadsheet has a Cross-Site Scripting (XSS) vulnerability in custom properties. Affects phpoffice/phpspreadsheet across 4 version ranges.

< 1.29.7 >= 2.0.0, < 2.1.6 >= 2.2.0, < 2.3.5 >= 3.0.0, < 3.7.0

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

PhpSpreadsheet is a popular open-source library used for reading and writing spreadsheet files in various formats, including Excel. It provides a range of features for manipulating spreadsheet data programmatically. However, a vulnerability has been identified in version 3.6.0, where custom properties can be exploited to execute arbitrary JavaScript code, posing a significant security risk.

Vulnerability Detail

The vulnerability arises from improper neutralization of input during web page generation, specifically in the handling of custom properties within Excel files. When an Excel file containing malicious custom properties is processed, the library generates an HTML representation without sanitizing these properties. This oversight allows attackers to embed JavaScript code that executes in the browser of any user viewing the generated HTML, potentially leading to data theft or other malicious actions.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.29.7 1.29.7
    composer require phpoffice/phpspreadsheet:1.29.7
  • >= 2.0.0, < 2.1.6 2.1.6
    composer require phpoffice/phpspreadsheet:2.1.6
  • >= 2.2.0, < 2.3.5 2.3.5
    composer require phpoffice/phpspreadsheet:2.3.5
  • >= 3.0.0, < 3.7.0 3.7.0
    composer require phpoffice/phpspreadsheet:3.7.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, sanitize any custom properties before including them in the Excel file. This can be done by escaping special characters in the property names and values to prevent the execution of any embedded scripts.

Conclusion

The Cross-Site Scripting vulnerability in PhpSpreadsheet highlights the importance of input sanitization in web applications. By updating to the latest version and implementing proper sanitization practices, users can protect their applications from potential exploits.

See every vulnerability recorded for phpoffice/phpspreadsheet →

Share this vulnerability

FAQ

CVE-2024-56410 is a vulnerability in PhpSpreadsheet that allows for Cross-Site Scripting (XSS) through unsanitized custom properties in Excel files.

If you are using PhpSpreadsheet version 3.6.0 or earlier, your application may be vulnerable. You can check your composer.lock file or use Vulert's playground to verify.

The vulnerability can lead to the execution of arbitrary JavaScript code in the browser, which may result in data theft, session hijacking, or other malicious activities.

Yes, you can use Vulert, which monitors your composer.lock file for open-source vulnerabilities in real-time, providing alerts for any issues.

If immediate updates are not possible, implement input sanitization for custom properties as a temporary measure to mitigate the risk.

Related vulnerabilities

Recent vulnerabilities recorded for phpoffice/phpspreadsheet.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.29.7 1.29.7
    composer require phpoffice/phpspreadsheet:1.29.7
  • >= 2.0.0, < 2.1.6 2.1.6
    composer require phpoffice/phpspreadsheet:2.1.6
  • >= 2.2.0, < 2.3.5 2.3.5
    composer require phpoffice/phpspreadsheet:2.3.5
  • >= 3.0.0, < 3.7.0 3.7.0
    composer require phpoffice/phpspreadsheet:3.7.0

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback