CVE-2025-22131: Cross-Site Scripting (XSS) vulnerability in generateNavigation() function

Published Jan 20, 2025
·
Updated

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.

php // Construct HTML $html = '';

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

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

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

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

PoC 1. Create an XLSX file with multiple sheets : !image

2. Generate the HTML content php <?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(); ?> 3. Enjoy !image

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. - ...

Other sources

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.

MITRE

Affected Software

10 affected componentsFixes available
PhpSpreadsheet PhpSpreadsheet
composer/phpoffice/phpexcel<=1.8.2
composer/phpoffice/phpspreadsheet>=2.2.0<2.3.6
2.3.6
composer/phpoffice/phpspreadsheet>=2.0.0<2.1.7
2.1.7
composer/phpoffice/phpspreadsheet<1.29.8
1.29.8
composer/phpoffice/phpspreadsheet>=3.0.0<3.8.0
3.8.0
PHPOffice phpspreadsheet<1.29.8
PHPOffice phpspreadsheet>=2.0.0<2.1.7
PHPOffice phpspreadsheet>=2.2.0<2.3.6
PHPOffice phpspreadsheet>=3.0.0<3.8.0

Event History

Jan 20, 2025
CVE Published
via MITRE·03:31 PM
Data Sourced
via MITRE·03:31 PM
DescriptionWeakness
Data Sourced
via NVD·04:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 21, 2025
Advisory Published
via GitHub·09:09 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-22131?

CVE-2025-22131 is classified as a critical vulnerability due to its potential for Cross-Site Scripting (XSS) attacks.

2

How do I fix CVE-2025-22131?

To fix CVE-2025-22131, upgrade the phpoffice/phpspreadsheet package to at least version 3.8.0 or apply the latest patches provided by the vendor.

3

What versions of phpoffice/phpspreadsheet are affected by CVE-2025-22131?

CVE-2025-22131 affects phpoffice/phpspreadsheet versions from 2.0.0 to 2.3.6 and below 1.29.8.

4

What type of vulnerability is CVE-2025-22131?

CVE-2025-22131 is a Cross-Site Scripting (XSS) vulnerability that arises from improper handling of input when translating XLSX files to HTML.

5

How can CVE-2025-22131 impact my application?

Exploiting CVE-2025-22131 could allow attackers to execute arbitrary JavaScript in the context of the victim's browser, potentially compromising user data or session.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203