CVE-2025-22131: PhpSpreadsheet Cross-Site Scripting (XSS) Vulnerability in generateNavigation() Function

phpoffice/phpspreadsheet Updated 02 Oct 2025

Summary

21/01/2025
Yes i
Moderate
6.1

CVE-2025-22131: Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet. Affects phpoffice/phpspreadsheet across 4 version ranges.

< 1.29.8 >= 2.0.0, < 2.1.7 >= 2.2.0, < 2.3.6 >= 3.0.0, < 3.8.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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

PhpSpreadsheet is a popular open-source library used for reading and writing spreadsheet files in various formats, including XLSX. It provides a set of features that allow developers to manipulate spreadsheet data easily. However, the library has a vulnerability that arises when generating HTML representations of XLSX files containing multiple sheets, specifically in the navigation menu that displays sheet names without proper sanitization.

Vulnerability Detail

The vulnerability is a Cross-Site Scripting (XSS) issue found in the generateNavigation() function of PhpSpreadsheet. It occurs when the library generates HTML from an XLSX file with multiple sheets. The sheet names are included in the navigation menu without any sanitization, allowing an attacker to inject malicious JavaScript code. This could lead to various security risks, including session hijacking, phishing attacks, and unauthorized access to user data.

How To Fix

Fixed versions by release line

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

  • < 1.29.8 1.29.8
    composer require phpoffice/phpspreadsheet:1.29.8
  • >= 2.0.0, < 2.1.7 2.1.7
    composer require phpoffice/phpspreadsheet:2.1.7
  • >= 2.2.0, < 2.3.6 2.3.6
    composer require phpoffice/phpspreadsheet:2.3.6
  • >= 3.0.0, < 3.8.0 3.8.0
    composer require phpoffice/phpspreadsheet:3.8.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, avoid using PhpSpreadsheet to generate HTML from XLSX files that contain untrusted or user-generated content until the library is updated. Ensure that sheet names are sanitized before being processed by the library.

Conclusion

The CVE-2025-22131 vulnerability in PhpSpreadsheet poses a significant risk due to its potential for XSS attacks. It is crucial for developers using this library to update to the latest patched versions and implement necessary workarounds to mitigate risks until updates can be applied.

See every vulnerability recorded for phpoffice/phpspreadsheet →

Share this vulnerability

FAQ

The XSS vulnerability can lead to session hijacking, data theft, redirection to malicious sites, and unauthorized actions on behalf of the user.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Versions prior to 3.8.0, 1.29.8, 2.1.7, and 2.3.6 are vulnerable to this XSS issue.

Vulert monitors and alerts for open-source vulnerabilities in your software by analyzing the composer.lock file, providing real-time updates.

If an immediate update is not possible, ensure that you sanitize any user-generated content and avoid generating HTML from untrusted XLSX files.

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.8 1.29.8
    composer require phpoffice/phpspreadsheet:1.29.8
  • >= 2.0.0, < 2.1.7 2.1.7
    composer require phpoffice/phpspreadsheet:2.1.7
  • >= 2.2.0, < 2.3.6 2.3.6
    composer require phpoffice/phpspreadsheet:2.3.6
  • >= 3.0.0, < 3.8.0 3.8.0
    composer require phpoffice/phpspreadsheet:3.8.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