CVE-2024-45046
JSON

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 packageVersionsReported by
PHPOffice PhpSpreadsheet< 2.1.0, before 1.29.1, from 2.0.0 before 2.1.0CVE List, NVD
phpspreadsheet_project phpspreadsheetbefore 2.1.0CVE List
phpoffice/phpspreadsheet (Packagist)from 2.0.0 before 2.1.0, before 1.29.1GitHub Advisory Database
phpoffice/phpexcel (Packagist)up to 1.8.2GitHub Advisory Database

All scores

GitHub_M5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
GitHub5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
NVD5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

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

Sources

SourceRecordLicence
CVE ListCVE-2024-45046 changed 2024-08-29CVE Terms of Use
GitHub Advisory DatabaseGHSA-wgmf-q9vr-vww6 changed 2025-03-06CC-BY-4.0
NVDCVE-2024-45046 changed 2026-06-17Public domain