CWE
79
Advisory Published
Advisory Published
Updated

CVE-2024-45046: PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information

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 SoftwareAffected VersionHow 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

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the severity of CVE-2024-45046?

    CVE-2024-45046 has a high severity rating due to the potential for arbitrary JavaScript injection.

  • How do I fix CVE-2024-45046?

    To fix CVE-2024-45046, upgrade to PhpSpreadsheet version 1.29.1 or 2.1.0.

  • What type of vulnerability is CVE-2024-45046?

    CVE-2024-45046 is a Cross-Site Scripting (XSS) vulnerability caused by improper sanitization of spreadsheet styling information.

  • Who is affected by CVE-2024-45046?

    CVE-2024-45046 affects users of the PhpSpreadsheet library versions prior to 1.29.1 and between 2.0.0 and 2.1.0.

  • What is the impact of CVE-2024-45046?

    The impact of CVE-2024-45046 allows an attacker to execute arbitrary JavaScript in the context of the affected web application.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203