5.4medium
PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information
- Severity
- 5.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.42% (higher than 38% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-wgmf-q9vr-vww6
Description
PHPSpreadsheet is a pure PHP library for reading and writing spreadsheet files. In affected versions `\PhpOffice\PhpSpreadsheet\Writer\Html` doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page. As a result an attacker may used a crafted spreadsheet to fully takeover a session of a user viewing spreadsheet files as HTML. This issue has been addressed in release version 2.1.0. All users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| PHPOffice PhpSpreadsheet | < 2.1.0, before 1.29.1, from 2.0.0 before 2.1.0 | CVE List, NVD |
| phpspreadsheet_project phpspreadsheet | before 2.1.0 | CVE List |
| phpoffice/phpspreadsheet (Packagist) | from 2.0.0 before 2.1.0, before 1.29.1 | GitHub Advisory Database |
| phpoffice/phpexcel (Packagist) | up to 1.8.2 | GitHub Advisory Database |
All scores
| GitHub_M | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/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:L/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N |
| NVD | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/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 pure PHP library for reading and writing spreadsheet files. In affected versions `\PhpOffice\PhpSpreadsheet\Writer\Html` doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page. As a result an attacker may used a crafted spreadsheet to fully takeover a session of a user viewing spreadsheet files as HTML. This issue has been addressed in release version 2.1.0. All users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
\PhpOffice\PhpSpreadsheet\Writer\Html doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page.
PoC
Example target script:
<?php
require 'vendor/autoload.php';
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$spreadsheet = $reader->load(__DIR__ . '/book.xlsx');
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
print($writer->generateHTMLAll());
Save this file in the same directory: book.xlsx
Open index.php in a web browser. An alert should be displayed.
Impact
Full takeover of the session of users viewing spreadsheet files as HTML.
NVD (es)
PHPSpreadsheet es una librería PHP pura para leer y escribir archivos de hojas de cálculo. En las versiones afectadas, `\PhpOffice\PhpSpreadsheet\Writer\Html` no desinfecta la información de estilo de las hojas de cálculo, como los nombres de las fuentes, lo que permite a un atacante inyectar JavaScript arbitrario en la página. Como resultado, un atacante puede usar una hoja de cálculo manipulada para apoderarse por completo de la sesión de un usuario que visualiza archivos de hojas de cálculo como HTML. Este problema se ha solucionado en la versión 2.1.0. Se recomienda a todos los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.
References
| https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-wgmf-q9vr-vww6 | exploit, third-party-advisory, web | |
| https://github.com/PHPOffice/PhpSpreadsheet/pull/3957 | issue-tracking, patch, web | |
| https://github.com/PHPOffice/PhpSpreadsheet/commit/f7cf378faed2e11cf4825bf8bafea4922ae44667 | patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2024-45046 | advisory | |
| https://github.com/PHPOffice/PhpSpreadsheet | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-45046 changed 2024-08-29 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-wgmf-q9vr-vww6 changed 2025-03-06 | CC-BY-4.0 |
| NVD | CVE-2024-45046 changed 2026-06-17 | Public domain |