phpoffice/phpspreadsheet
Affected
- introduced
3.0.0, fixed3.8.0(ecosystem)
Fixed versions
3.8.0
Fix
The export has no generic command for this ecosystem.
Advisory
Also known as: CVE-2025-22131
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
<?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();
?>
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 :
Medium Basis: The source's own band: MODERATE
3.0.0, fixed 3.8.0 (ecosystem)3.8.0
The export has no generic command for this ecosystem.
0, fixed 1.29.8 (ecosystem)1.29.8
The export has no generic command for this ecosystem.
2.0.0, fixed 2.1.7 (ecosystem)2.1.7
The export has no generic command for this ecosystem.
2.2.0, fixed 2.3.6 (ecosystem)2.3.6
The export has no generic command for this ecosystem.
0, last affected 1.8.2 (ecosystem)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0