Every CVE Search/ Get API key

CVE-2025-22131

Cross-Site Scripting (XSS) vulnerability in generateNavigation() function

5.1 MediumPublic exploitFix available

CVE-2025-22131 is a medium vulnerability (CVSS 5.1) in Phpoffice Phpspreadsheet, published January 20, 2025. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 0.40%, the 33rd percentile. Fixed in phpoffice/phpspreadsheet 3.8.0.

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
Active

What an attacker can affect

Confidentiality
Low
Integrity
Low
Availability
None

Exploit likelihood

0.40%Up 0.4 points since Jan 21, 2025
90%50%10%1%

What each source reports

CVE List Score used 5.1

Cross-Site Scripting (XSS) vulnerability in generateNavigation() function

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Record
CVE-2025-22131
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-79
Updated
2026-11-02
EUVDEUVD-2025-0143 5.1

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Record
EUVD-2025-0143
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
Updated
2026-11-03
GitHub AdvisoriesGHSA-79xx-vf93-p7cx 5.1

Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet

Summary

The researcher discovered zero-day vulnerability Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Details

When generating the HTML from an xlsx file containing multiple sheets, a navigation menu is created. This menu includes the sheet names, which are not sanitized. As a result, an attacker can exploit this vulnerability to execute JavaScript code.

        // Construct HTML
        $html = '';

        // Only if there are more than 1 sheets
        if (count($sheets) > 1) {
            // Loop all sheets
            $sheetId = 0;

            $html .= '<ul class="navigation">' . PHP_EOL;

            foreach ($sheets as $sheet) {
                $html .= '  <li class="sheet' . $sheetId . '"><a href="#sheet' . $sheetId . '">' . $sheet->getTitle() . '</a></li>' . PHP_EOL;
                ++$sheetId;
            }

            $html .= '</ul>' . PHP_EOL;
        }

PoC

  1. Create an XLSX file with multiple sheets :

  2. Generate the HTML content

<?php
	require __DIR__ . '/vendor/autoload.php';

	$inputFileName = 'payload.xlsx';
	$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
	$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
	$writer->writeAllSheets();
	echo $writer->generateHTMLAll();
?>
  1. Enjoy

Impact

XSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise. Example of impacts :

  • Disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account (Only if HttpOnly cookie's flag is set to false).
  • Redirecting the user to some other page or site (like phishing websites)
  • Modifying the content of the current page (add a fake login page that sends credentials to the attacker).
  • Automatically download malicious files.
  • Requests access to the victim geolocation / camera.
  • ...
Record
GHSA-79xx-vf93-p7cx
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
NVD 5.1

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Record
CVE-2025-22131
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/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
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
OSV 5.1

Cross-Site Scripting (XSS) vulnerability in generateNavigation() function

PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Record
CVE-2025-22131
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-79
Updated
2026-11-02
OSVGHSA-79xx-vf93-p7cx 5.1

Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet

Summary

The researcher discovered zero-day vulnerability Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.

Details

When generating the HTML from an xlsx file containing multiple sheets, a navigation menu is created. This menu includes the sheet names, which are not sanitized. As a result, an attacker can exploit this vulnerability to execute JavaScript code.

        // Construct HTML
        $html = '';

        // Only if there are more than 1 sheets
        if (count($sheets) > 1) {
            // Loop all sheets
            $sheetId = 0;

            $html .= '<ul class="navigation">' . PHP_EOL;

            foreach ($sheets as $sheet) {
                $html .= '  <li class="sheet' . $sheetId . '"><a href="#sheet' . $sheetId . '">' . $sheet->getTitle() . '</a></li>' . PHP_EOL;
                ++$sheetId;
            }

            $html .= '</ul>' . PHP_EOL;
        }

PoC

  1. Create an XLSX file with multiple sheets :

  2. Generate the HTML content

<?php
	require __DIR__ . '/vendor/autoload.php';

	$inputFileName = 'payload.xlsx';
	$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
	$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
	$writer->writeAllSheets();
	echo $writer->generateHTMLAll();
?>
  1. Enjoy

Impact

XSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise. Example of impacts :

  • Disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account (Only if HttpOnly cookie's flag is set to false).
  • Redirecting the user to some other page or site (like phishing websites)
  • Modifying the content of the current page (add a fake login page that sends credentials to the attacker).
  • Automatically download malicious files.
  • Requests access to the victim geolocation / camera.
  • ...
Record
GHSA-79xx-vf93-p7cx
CVSS 4.0
5.1 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
phpoffice/phpspreadsheet
Packagist
3.0.0 up to 3.8.0
3.8.0
phpoffice/phpspreadsheet
Packagist
before 1.29.8
1.29.8
phpoffice/phpspreadsheet
Packagist
2.0.0 up to 2.1.7
2.1.7
phpoffice/phpspreadsheet
Packagist
2.2.0 up to 2.3.6
2.3.6
phpoffice/phpexcel
Packagist
through 1.8.2 None known
phpoffice/phpspreadsheet
Packagist
3.0.0 up to 3.8.0, plus listed versions
3.3.03.4.03.5.03.6.03.7.0
3.8.0
phpoffice/phpspreadsheet
Packagist
before 1.29.8, plus listed versions
1.0.01.0.0-beta1.0.0-beta21.1.01.10.0
Show 45 moreShow less
1.10.11.11.01.12.01.13.01.14.01.14.11.15.01.16.01.17.01.17.11.18.01.19.01.2.01.2.11.20.01.21.01.22.01.23.01.24.01.24.11.25.01.25.11.25.21.26.01.27.01.27.11.28.01.29.01.29.11.29.21.29.41.29.51.29.61.29.71.3.01.3.11.4.01.4.11.5.01.5.11.5.21.6.01.7.01.8.01.8.1
1.29.8
phpoffice/phpspreadsheet
Packagist
2.0.0 up to 2.1.7, plus listed versions
2.1.02.1.12.1.32.1.42.1.52.1.6
2.1.7
phpoffice/phpspreadsheet
Packagist
2.2.0 up to 2.3.6, plus listed versions
2.2.12.2.22.3.02.3.22.3.32.3.42.3.5
2.3.6
phpoffice/phpexcel
Packagist
through 1.8.2, plus listed versions
1.7.91.7.9-rc11.8.01.8.0rc11.8.0rc21.8.0rc31.8.0rc41.8.1
None known

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubZzN1NJ4/CVE-2025-22131-PoC2025-09-03
PoC in GitHubs0ck37/CVE-2025-22131-POC2025-09-05

History

History
WhenChangedSources
2026-11-03aliases, publishedEUVD
2026-11-02createdCVE List, GitHub Advisories, NVD, OSV, PoC in GitHub

References

This page doesn't list everything

Left out here: 2 versions. The JSON record has them.

MoveEnter Open