5.1medium
Cross-Site Scripting (XSS) vulnerability in generateNavigation() function
- Severity
- 5.1medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.40% (higher than 35% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-79xx-vf93-p7cx
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| PHPOffice PhpSpreadsheet | >= 3.0.0, < 3.8.0, >= 2.2.0, < 2.3.6, >= 2.0.0, < 2.1.7, < 1.29.8, before 1.29.8, from 2.0.0 before 2.1.7, from 2.2.0 before 2.3.6, from 3.0.0 before 3.8.0 | CVE List, NVD |
| phpoffice/phpspreadsheet (Packagist) | from 3.0.0 before 3.8.0, before 1.29.8, from 2.0.0 before 2.1.7, from 2.2.0 before 2.3.6 | GitHub Advisory Database |
| phpoffice/phpexcel (Packagist) | up to 1.8.2 | GitHub Advisory Database |
All scores
| GitHub_M | 5.1medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
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
-
Create an XLSX file with multiple sheets : image
-
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();
?>
- 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.
- ...
NVD (es)
PhpSpreadsheet es una librería de PHP para leer y escribir archivos de hojas de cálculo. Vulnerabilidad de Cross-Site Scripting (XSS) en el código que traduce el archivo XLSX a una representación HTML y lo muestra en la respuesta.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-22131 changed 2025-01-21 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-79xx-vf93-p7cx changed 2025-03-06 | CC-BY-4.0 |
| NVD | CVE-2025-22131 changed 2026-06-17 | Public domain |