Media

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

  • Publicada: 21.01.2025
  • Actualizado: 11.10.2026 10:22

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">' . 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 : 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();
?>
  1. 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.
  • ...

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer phpoffice/phpexcel <= 1.8.2 sin corrección
Paquete de Composer phpoffice/phpspreadsheet >= 3.0.0, < 3.8.0, < 1.29.8, >= 2.0.0, < 2.1.7, >= 2.2.0, < 2.3.6 3.8.0, 1.29.8, 2.1.7, 2.3.6

Referencias

Puntuación CVSS 6.1/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Debilidad (CWE)
CWE-79
Plataforma
Composer
Paquete
phpoffice/phpexcel, phpoffice/phpspreadsheet
Publicada
21.01.2025
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-79xx-vf93-p7cx - CC BY 4.0

Historial de vulnerabilidades: phpoffice/phpexcel

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (23) en el archivo
Entradas en total
23
Primera → última
11.2019 02.2025
Sin corrección
20
Explotada en ataques
0

Distribución por gravedad

  • Alta 12
  • Media 10
  • Baja 1

Divulgaciones por año

  1. 2019: 2
  2. 2020: 0
  3. 2021: 1
  4. 2022: 1
  5. 2023: 0
  6. 2024: 10
  7. 2025: 9
  8. 2026: 0
Gravedad:
  1. Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet esta entrada
    Media · 6.1 CVE-2025-22131 <= 1.8.2 sin corrección
  2. Alta · 7.1 CVE-2024-56409 <= 1.8.2 sin corrección
  3. Alta · 7.1 CVE-2024-56366 <= 1.8.2 sin corrección
  4. Alta · 7.1 CVE-2024-56408 <= 1.8.2 sin corrección
  5. Alta · 7.5 CVE-2024-48917 <= 1.8.2 sin corrección
  6. Alta · 7.5 CVE-2024-47873 <= 1.8.2 sin corrección
  7. Alta CVE-2015-3542 < 1.8.1 1.8.1
  8. Alta · 7.5 CVE-2024-45293 <= 1.8.2 sin corrección
  9. Alta · 8.8 CVE-2024-45048 <= 1.8.2 sin corrección
  10. Alta · 8.8 CVE-2019-12331 <= 1.8.2 sin corrección
  11. Alta · 8.8 CVE-2018-19277 < 1.8.2 1.8.2

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.