First published: Wed Aug 28 2024(Updated: )
### 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](https://github.com/PHPOffice/PhpSpreadsheet/files/15212797/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.
Credit: security-advisories@github.com security-advisories@github.com
Affected Software | Affected Version | How to fix |
---|---|---|
composer/phpoffice/phpspreadsheet | <1.29.1 | 1.29.1 |
composer/phpoffice/phpspreadsheet | >=2.0.0<2.1.0 | 2.1.0 |
PhpSpreadsheet | <1.29.1 | |
PhpSpreadsheet | >=2.0.0<2.1.0 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
CVE-2024-45046 has a high severity rating due to the potential for arbitrary JavaScript injection.
To fix CVE-2024-45046, upgrade to PhpSpreadsheet version 1.29.1 or 2.1.0.
CVE-2024-45046 is a Cross-Site Scripting (XSS) vulnerability caused by improper sanitization of spreadsheet styling information.
CVE-2024-45046 affects users of the PhpSpreadsheet library versions prior to 1.29.1 and between 2.0.0 and 2.1.0.
The impact of CVE-2024-45046 allows an attacker to execute arbitrary JavaScript in the context of the affected web application.